Step 5A Sample Program for the PICAXE
The "start" terminator is ignored by the compiler, but is useful to you to easily locate the start of your program.
The "pause" process tells the PICAXE to wait 1000 miliseconds, or 1 second before proceeding to the next step in the program. When you tell the PICAXE to execute the program, you will notice a 1 second pause before anything happens.
The parallelogram flowchart symbol represents data, or input/output. It contains the command "high 4" and this command will set pin 4 high, which means the microcontroller will send voltage to that pin, or output current to that pin. If you have a motor connected to pin 4 then current from this pin will pass through the motor and the motor will begin to spin.
This "pause" process tells the PICAXE to wait 10000 miliseconds, or ten seconds. This means pin 4 will remain high for 10 seconds thus continuing to send current to the motor for ten seconds (the motor will spin for ten seconds).
This data flowchart symbol contains the command "low 4." It tells the PICAXE to turn the pin off, or to output 0 volts. This will cut power to the pin and the motor connected to it will stop spinning.
If you want to see what the BASIC code looks like, you can click Flowchart and then click Convert Flowchart to BASIC. The code will look like the the following:
‘BASIC converted from flowchart:
‘C:\DOCUMENTS AND SETTINGS\DESKTOP\SNAPROVERBOT.CAD
‘Converted on 10/30/2011 at 20:53:11
main:
pause 1000 'Tells the PICAXE to wait 1000 miliseconds (1 second)
high 4 'Sets pin 4 high, which sends current to pin 4 (if there is a motor connected it will spin)
pause 10000 'Tells the PICAXE to wait 10000 miliseconds (10 seconds--motor will spin for 10 seconds)
low 4 'Sets pin 4 low, or ouputs 0 volts. This cuts the power to the pin and the motor stops spinning
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|

















































