Shop OBEX P1 Docs P2 Docs Learn Events
bs2 simple using debugin command help — Parallax Forums

bs2 simple using debugin command help

Ben11691Ben11691 Posts: 1
edited 2008-02-08 06:01 in BASIC Stamp
im really new to basic stamp and im looking for help regarding the debugin comand that allows you to enter numbers the the debug window

ultimatly i would like to enter a number lets say 1 and in return i would like power to go to pin1·.. so when i type one it sends power lighting an led or whatever,, on top of that i would like to make it so if i put in say 2 it would send power to a diffrent pin so i could turn on differnt leds with differnt numbers in the debug window... and if thats not complicated enough i want it when i hold· say the 1 button down in the window it keeps the light corosponing to that pin # on

any and all help/code samples would be much appreciated thanks for the help!!!! Ben

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-08 06:01
    You'll need to write a program to do this. The DEBUGIN statement can receive a number into a variable X by using the DEC formatter as in the statement "DEBUGIN DEC X". If you read the section of the Parallax Basic Manual on memory allocation, you'll see that the output register is a 16 bit value with each bit corresponding to an I/O pin. It would be easy to use the received number as a shift count as in "OUTS = OUTS | (1 << X)" which would set the corresponding I/O pin to HIGH and "OUTS = OUTS &/ (1 << X)" which would set the corresponding I/O pin to LOW. See if you can figure out how these statements work. I suggest using a piece of paper to write down the result of each operation in turn.
Sign In or Register to comment.