New To Basic Stamps - Help
Lycan_Galen
Posts: 4
Hello.· I'm new to Basic stamps, so I'm just learning to code as I go.· Which also means I'm runing into trouble already, lol.
I'm trying to make a program where there are two buttons.· One button is a reset button which, obviously, sets everything back to where it was in the beginning, the other button I want to light up one LED the first time it is pressed, two the second time, three the third, etc.· all the way to ten LEDs.· I guess I should mention I'm working with a BS2.· I'm·attaching what I have coded in a txt file, can someone take a look and tell me where I'm going wrong?· Right now all I have is a bunch of LEDs that flicker on and off in synch, regardless of what I'm doing with the buttons.·
Thanks a lot in advance, and yes, I know there's probably a much cleaner way to write this, but like I said, I'm new to this whole thing. Though I'm open to suggestions to simplify all around [noparse]:)[/noparse]
I'm trying to make a program where there are two buttons.· One button is a reset button which, obviously, sets everything back to where it was in the beginning, the other button I want to light up one LED the first time it is pressed, two the second time, three the third, etc.· all the way to ten LEDs.· I guess I should mention I'm working with a BS2.· I'm·attaching what I have coded in a txt file, can someone take a look and tell me where I'm going wrong?· Right now all I have is a bunch of LEDs that flicker on and off in synch, regardless of what I'm doing with the buttons.·
Thanks a lot in advance, and yes, I know there's probably a much cleaner way to write this, but like I said, I'm new to this whole thing. Though I'm open to suggestions to simplify all around [noparse]:)[/noparse]
Comments
Also, since your buttons appear to be active high, make sure you have pulldown resistors on the input pins you're using for the buttons (that is, make sure the pins aren't floating when the button isn't pressed).
Mike
The changes you need to make to control your real world outputs are
1) replace the DEBUG statement with OUTS=light
2) replace DEBUGIN with the·command from your switches (taking Mike's advice about resistors)
Jeff T.
Unsoundcode - I followed you all the way to "ELSEIF light<4093", I'm stumped as to where you got that number from, lol.
Back to the books I guess.
Thanks again.
Jeff T.
I've double checked my wires, the leds are going from the pins to ground, there are pull down resistors on the buttons, the buttons are plugged into the first two pins and positive, and the stamp stack is plugged in properly.· Any suggestions where to look?
I've attached my updated coding, but I don't think the problem is there since it was working fine on the other breadboard.
Thanks again.