Picaxe Coding Help?
Ok, i havemade a little picaxe code that i hope will do exactly what i want. I made this to make a light show from a light show... the imput is the 1 led that would normally be blinking like a maniac. I want to use its blinking to make another light blink a little more interestingly. PLEASE TELL ME IF THIS WILL DO WHAT I WANT! CODE:
main: pulsin 6, 1, b3
if b3< 50 then
high 9
pause 2
else
low 9
pause 2
endif
if b3< 10 then
low 9
pause 500
high 9
else
high 9
pause 100
low 9
endif
if b3> 50 then
low 9
pause 900
high 9
pause 17
low 9
pause 220
high 9
else
high 9
pause 20
low 9
pause 416
high 9
pause 22
low 9
endif
if b3> 10 then
low 9
pause 20
high 9
pause 921
low 9
pause 19
high 9
else
high 9
pause 543
low 9
pause 22
high 9
pause 611
low 9
endif
if b3< 25 then
low 9
pause 442
high 9
pause 224
low 9
else
high 9
pause 61
low 9
pause 669
high 9
endif
if b3> 25 then
low 9
pause 229
high 9
pause 29
low 9
endif
if b3< 75 then
high 9
pause 224
low 9
pause 442
else
low 9
pause 424
high 9
pause 242
endif
if b3> 75 then
high 9
pause 717
low 9
pause 171
else
low 9
pause 123
high 9
pause 321
endif
goto main
I am using a picaxe 14m with a serial programmer. i just need to know about the code. And dont ask "why dont u test it urself" I have good reason not to test it. The board is in another state... anyway, plz tell me about the code and if it will work. If possible, make sudjustions.
Comments
10 years ago
You can try it without the chip.
A quick google turned up several hits for picaxe simulators. Many links were dead, but this freely downloadable one seems to be working.
Answer 10 years ago
Hi Kiteman, the VSM only allows you to simulate their circuit samples until you purchase a license for 50 quid. The totally free programming editor includes a simulator for Picaxe with a smaller variety of common devices, and isn't as graphically pretty.
Answer 10 years ago
'K
10 years ago
Have you tried running this in the programming editor simulator (free from the Rev-Ed Picaxe site)? I think not as your pulsin statement throws a syntax error - there is no input pin 6 on the 14m.
Do you mean pin 6 on the chip (which is input pin 1)?, so your statement would be pulsin 1, 1, b3.
Download the editor and for the purposes of testing the code, comment out the pulsin statement and put in the line READADC 0,b3. Then use the simulator to set the ADC 0 input to various values to see if the program flow is what you expect.
To make the code more readable, you might consider using the SELECT CASE statement - Page 190 of manual 2.
Answer 10 years ago
If you're using the Programming Editor, a useful tip is to put the line #picaxe 14m at the top of the program. This tells the syntax checker / simulator which device you're using.
10 years ago
I suspect it won't do what you want - even though you don't say what you want, because your IF statements are not going to work Step through it on paper very carefully.
What happens for example when B3 is 25 ? How many IF statements will affect the lamp.
Steve