Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp project challenge — Parallax Forums

Basic Stamp project challenge

LAKSJGBLAVLAKSJGBLAV Posts: 2
edited 2013-11-20 17:00 in General Discussion
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:
  1. On start, sound the speaker at 3000 Hz for 1 second.
  2. 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).
  3. 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
  4. Repeat the program from step 2.
Notes: If PB1 is release while in the middle of sequence, don't worry about aborting the sequence. Keep it simple

Comments

  • ercoerco Posts: 20,256
    edited 2013-11-20 07:32
    Sure sounds like a school assignment to me. Have you tried? Show us!
  • LAKSJGBLAVLAKSJGBLAV Posts: 2
    edited 2013-11-20 07:38
    This is where I am so far while configuring the stamp is not a problem for me being I have a background in electronics coding is completely new for me. DO
    Debug ? IN2
    FREQOUT 8, 1000, 3000
    IF (IN1= 0) THEN
    HIGH 5
    PAUSE 500
  • ercoerco Posts: 20,256
    edited 2013-11-20 08:54
    First things first. Do you have a Stamp to test your program on? Board of Education or Homework board, or a bare Stamp in a breadboard? Have you tried to program it? Is your computer & USB cable working and programming the Stamp correctly?
  • Mike GreenMike Green Posts: 23,101
    edited 2013-11-20 09:18
    Make sure you have copies on hand of "What's a Microcontroller?" and the "BASIC Stamp Syntax and Reference Manual". The webstore page for each book has a link to the free PDF download for the book.
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-11-20 15:06
    LAKSJGBLAV wrote: »
    This is where I am so far while configuring the stamp is not a problem for me being I have a background in electronics coding is completely new for me.

    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...
    DO
    Debug ? IN2
    FREQOUT 8, 1000, 3000
    IF (IN1= 0) THEN
       HIGH 5
       PAUSE 500
    

    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.
  • GenetixGenetix Posts: 1,754
    edited 2013-11-20 17:00
    Do you know if the Pushbutton is Active-High or Active-Low?
Sign In or Register to comment.