mrburnette
Senior Member
So often, it is necessary to just blink a LED on a pin to give us some satisfaction that something is going on inside that PICAXE chip. The perfect example is capturing a serial ASCII stream using SERIN with qualifiers/timeouts. What I see most PICAXE'rs doing is using a conditional statement (IF) and checking if a variable is 1 or 0 and then making the LED HIGH/LOW to toggle the state.
Due to the nature of the sink/source capability of many of PICAXE pins and the fact that most PICAXE pins can be bidirectional a very simple one-statement approach can be taken.
- Select a Pin that is bidirectional (not hardwired as input/output)
- If possible, select a pin that is both sink/source for output
- Code
Here is an example for the simulator. Sticking the REVERSE instruction anywhere in your code that is repetitively called will provide a simple, visual "I'm alive" signal to comfort the weary programmer. Use two pins for bi-colored LEDs! When using SERIN with a timeout and no "goto" option, place the 'reverse LED' statement after the SERIN command. With SERIN and a "goto", place the 'reverse LED' statement as the first statement after the LABEL. Be creative, the above are just suggestions.
- Ray
Due to the nature of the sink/source capability of many of PICAXE pins and the fact that most PICAXE pins can be bidirectional a very simple one-statement approach can be taken.
- Select a Pin that is bidirectional (not hardwired as input/output)
- If possible, select a pin that is both sink/source for output
- Code
Here is an example for the simulator. Sticking the REVERSE instruction anywhere in your code that is repetitively called will provide a simple, visual "I'm alive" signal to comfort the weary programmer. Use two pins for bi-colored LEDs! When using SERIN with a timeout and no "goto" option, place the 'reverse LED' statement after the SERIN command. With SERIN and a "goto", place the 'reverse LED' statement as the first statement after the LABEL. Be creative, the above are just suggestions.
Code:
#picaxe 18M2
Symbol LED = C.1
HIGH LED
Do
REVERSE LED
PAUSE 1000
Loop
- Ray