Basic Stamp project challenge
LAKSJGBLAV
Posts: 2
Hi all! New to parallax and its products I am working with the Basic Stamp homework board and am having problems with the coding to the following challenge: Use the following devices as specified:Pushbutton on P2 (PB1)
An active-high LED on P5 (LED1)
An active-high LED on P6 (LED2)
Buzzer/speaker on P8 (BUZZER)
Program the controller to perform the following:
An active-high LED on P5 (LED1)
An active-high LED on P6 (LED2)
Buzzer/speaker on P8 (BUZZER)
Program the controller to perform the following:
- On start, sound the speaker at 3000 Hz for 1 second.
- When/If PB1 is NOT pressed:
Blink LED1 at a rate of once per second (500 mS on, 500mS off).
Display "Waiting for button..." in the DEBUG Window (once or repeatedly). - When/If PB1 is pressed:
Turn on LED1 for 250 mS
Sound the BUZZER at 4000 Hz for 250 mS
Turn off LED1, Turn on LED2
Sound the Speaker at 3000 Hz for 100 mS - Repeat the program from step 2.
Comments
Debug ? IN2
FREQOUT 8, 1000, 3000
IF (IN1= 0) THEN
HIGH 5
PAUSE 500
That's not all that far...
Quick tip; don't use all those FONT an whatever ommands to format your code, instead use the CODE tags (Put the word 'CODE' in square brackets, then at the end of the code use '/CODE' in another set of square brackets to end the code segment)
Makes it much easier to quote your posts and code...
A god rule is to ALWAYS add any 'remainder' of 'multiword' structures immediately.
When putting in an IF, also add an ELSE and an ENDIF
This program has an 'event loop' (It loops back to point 2 time and time again.)
You need to add a label and a jump back to it at the end of the program.
It's also a good habit to add an 'END' command at the end of the program.