PDA

View Full Version : Beginner in need of help !!



robbo78
- 15th January 2015, 13:17
Hi everyone, I am completely new to both these forums & pic programming. I am working with the 12f683 which I have managed to flash led 's read potentiometers etc, very basic stuff.

Now to my question. I want to turn an LED on/off with a single tap of a tactile button. So press & release button: led turns on, then repeat to turn led off.

I knio how to turn an LED on/off by holding the button for on & releasing for off, but I can't work out how to do the above.

Any help would be greatly appreciated, I intend to over come any hiccups, not give up.

Thanks,
Rob

peterdeco1
- 15th January 2015, 14:32
The easiest way would be to use the TOGGLE command.

start:
if (your input pin) = 0 then toggle (your led port) : pause 50 : goto start
goto start

Charlie
- 15th January 2015, 14:47
Please don't post the same question in multiple locations. Pretty much everybody reads all the forums here, and it's helpful to keep all the responses together. Welcome aboard!

robbo78
- 15th January 2015, 15:32
Sorry Charlie, I wasn't sure of where to post this. I was going to ask a mod to close one of them, bit silly really.