triton82354
Member
Moving a stepper clockwise/counterclockwise...I have assigned b0=5 b0=10 to each direction and trying writing it to the eeprom .....I found this thread
http://www.picaxeforum.co.uk/showthread.php?t=13629&highlight=storing+data
with in this thread hippy posted:
Think of Eeprom as a chest of drawers, each drawer numbered; whatever data is stored in a drawer can be retrieved from that drawer so ...
WRITE 3, 29 would store the number in drawer 3
READ 3, b0 would retrieve the number stored in drawer 3, b0 would be set to 29
my fear is that iam just writing over to the same drawer so to speak...
not use if this part of the coded is working
learn:
write 1,b0 ‘ write value into b0
pause 2000
return
http://www.picaxeforum.co.uk/showthread.php?t=13629&highlight=storing+data
with in this thread hippy posted:
Think of Eeprom as a chest of drawers, each drawer numbered; whatever data is stored in a drawer can be retrieved from that drawer so ...
WRITE 3, 29 would store the number in drawer 3
READ 3, b0 would retrieve the number stored in drawer 3, b0 would be set to 29
my fear is that iam just writing over to the same drawer so to speak...
Code:
main:
do
if pinc.1 = 1 then 'move stepper left
pause 2000
gosub moveleft
endif
if pinc.2 = 1 then 'move stepper right
pause 2000
gosub moveright
endif
if pinc.3 = 1 then 'move stepper right
pause 2000
gosub cycle
endif
loop
moveleft:
pause 1000
b1 = b1 + 1 & %00000011
let b0 = b0 + 1
if b0 < 5 then moveleft 'step multiplier for gear ratio
if pinc.7 = 1 then
pause 2000
let b0=5
gosub learn
endif
return
moveright:
pause 1000
b1 = b1 - 1 & %00000011
let b0 = b0 + 1
if b0 < 5 then moveleft 'step multiplier for gear ratio
pause 2000
if pinc.7 = 1 then 'learn mode
pause 2000
let b0=10
gosub learn
endif
return
learn:
write 1,b0 ‘ write value into b0
pause 2000
return
cycle:
'code to be added
not use if this part of the coded is working
learn:
write 1,b0 ‘ write value into b0
pause 2000
return