Quote Originally Posted by WarPony View Post
I am getting all twisted up with the button code and loop. I havent added my switches to my circuit yet. I just want 1 to be added to or subtracted from my setpoint when one of the two switches is pressed.
When we say pullup/pulldown, generally we're referring to the state of the pin when the switch isn't being actuated.
Usually, a person will put a resistor (4.7K-10K, whatever), from the pin to Vdd, and the switch is wired in to ground that pin. Since the resistor runs from the pin to Vdd, the pin is high with the switch open, low with the switch closed.
So, if you want to use the button command, that's great...but why not play around with it without using the button command so you can understand it's inner working a bit better.
i.e.
loop:
if switch1 = 0 then setpoint = setpoint - 1
if switch2 = 0 then setpoint = setpoint + 1
......blah blah blah....
Yes, a loop like this will likely execute entirely too fast, and will most likely cause the setpoint value to 'wrap around'...but that's what 'pause' can be used for.