i've decided to move on from Picaxe and give Arduino ago. I'm trying to do a simple program which would take about 5 mins on the Picaxe but am lost when i comes to the Arduino.
I am after one button to one PWM ouput.
basically one button, press it once and 1/4 pwm then second 1/2 pwm, etc, then off.
On the Picaxe i would define little subroutines and jump back and forth (gosub or goto in spectrum basic) but cant find how to do this on the Arduino.
vectraboyv6:
On the Picaxe i would define little subroutines and jump back and forth (gosub or goto in spectrum basic) but cant find how to do this on the Arduino.
If you write the program as you would for the Picaxe and post it we can explain what needs to be different.
Right here's my picaxe code which works 100%. in picaxe i can goto subroutines with main: or third: etc i cant find a way to do this in arduino.. many thanks
; mirror gesture brightness control
; version 3
;
w0 = 2500 ; wait time
b10 = 8 ; ramp up pause
b12 = 5 ; ramp down pause
main:
if pinb.5 = 1 then goto third
goto main
third:
;soft ramp up loop
for b9 = 0 to 80
pwmout pwmdiv64, C.0, 64, b9
pause b10
next b9
pause w0
waitswitch:
if pinb.5 =1 then goto twothirds
goto waitswitch
twothirds:
;soft ramp up loop
for b9 = 81 to 159
pwmout pwmdiv64, C.0, 64, b9
pause b10
next b9
pause w0
waitswitchone:
if pinb.5 =1 then goto full
goto waitswitchone
full:
;soft ramp up loop
for b9 = 160 to 255
pwmout pwmdiv64, C.0, 64, b9
pause b10
next b9
pause w0
totaloff:
if pinb.5 =1 then goto finnish
goto totaloff
finnish:
;soft ramp down loop
for b9 = 254 to 0 step -1
pwmout pwmdiv64, C.0, 64, b9
pause b12
next b9
pause w0
goto main
vectraboyv6:
On the Picaxe i would define little subroutines and jump back and forth (gosub or goto in spectrum basic) but cant find how to do this on the Arduino.