Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 need help!! make flashing LED
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jhon8899




PostPosted: Sun Jan 22, 2012 2:47 pm   Post subject: need help!! make flashing LED

What is it you are trying to achieve?
i have a computer engineering project where i
need to make a turing program that hooks up to a breadboard and has a flashing LED
you need to be able to turn the LED on and off
flash a set number of times,
and to get the user to enter how many times they want it to flash


What is the problem you are having?
i am having a problem with the last 2 steps getting the led to flash on and off

Describe what you have tried to solve this problem
i have tried for hours to figure it out but im very new to turing
and my teacher isnt much help this is my last resort i really cant afford to fail


this is what i have so far if any one could help me or
give me a few tips it would be greatly appreciated

Turing:


<const ON : string := "ON"
const OFF : string := "OFF"
var LED_red : string
var option : int

% initialize all three LEDs as ON at the beginning
LED_red := ON

% declare a procedure for menu so that it can be re-used whenever needed
procedure menu
    cls
    % display the status of 3 LEDs and the main menu
    put "RED:" : 8, LED_red
 
    put skip
    put "1.  Turn on a LED"
    put "2.  Turn off a LED"
    put "3.  Make LED flash 10 times"
    put "4.  Choese how many times LED flashes "
   
    put skip
    put skip
    put "Please enter your option:"
end menu
loop
    menu
    get option
    delay (3000)
    % if the user choose option 1
    if option = 1 then
       
            if  LED_red = OFF then
                LED_red := ON
       
            else
                put "The LED is already on."
                delay (3000)
            end if
       
        % if the user choose option 2
    elsif option = 2 then
       
           
            if LED_red = ON then
                LED_red := OFF
           
            else
                put "The LED is already off."
                delay (3000)
            end if
     
        % if the user choose option 3
    elsif option = 3 thene>



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Sun Jan 22, 2012 2:58 pm   Post subject: RE:need help!! make flashing LED

Couldn't it be as simple as turing LED_red on, then drawing the menu, off and then draw the menu, and repeat it 10 times?

code:

LED_red := ON
menu
LED_red := OFF
menu
.
.
.
jhon8899




PostPosted: Sun Jan 22, 2012 9:33 pm   Post subject: Re: need help!! make flashing LED

Ohh thanks
How would that work for entering the number of times you want it to flash?
Aange10




PostPosted: Sun Jan 22, 2012 9:54 pm   Post subject: RE:need help!! make flashing LED

idk, how do you repeat 10 times
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: