i've been searching the posts and am cobbling up a program that probably has been done already. please note that I dont have all the hardware ready yet, so I havent tested to see if it'll work.
I just want to see if I am on the right track here. my plan is for this program to control a parafoil type parachute to direct it towards a specific landing area. I dont have the GPS yet, so I stole some code from the forums and tried to suss it out correctly. then I saw the limitations on variables, so I used POKEs and PEEKs.
still need to work out a compass section of the code, but the rest should work if I understand it correctly. on the other hand, i might have my directions reversed
I just want to see if I am on the right track here. my plan is for this program to control a parafoil type parachute to direct it towards a specific landing area. I dont have the GPS yet, so I stole some code from the forums and tried to suss it out correctly. then I saw the limitations on variables, so I used POKEs and PEEKs.
still need to work out a compass section of the code, but the rest should work if I understand it correctly. on the other hand, i might have my directions reversed
Code:
#picaxe 14m
poke 80,4,4,1,8,1,2,7,2 'set target lat= 44°18'12.72"N
poke 90,9,0,4,2,5,8,9,3 'set target long= 90°42'58.93"W
serin 1,t9600_8,("N"),b0,b1,b2,b3,b4,b5,b6 'read latitude from gps
poke 100,b0,b1,b2,b3,b4,b5,b6 'store latitude
serin 1,t9600_8,("W"),b0,b1,b2,b3,b4,b5,b6 'read longitude from gps
poke 110,b0,b1,b2,b3,b4,b5,b6 'store longitude
b12=80
do 'test loop for latitude
b12=b13+20
peek b13,b0 'get next target character
peek b12,b1 'set next position character
if b0>b1 then 'compare target to position, if south
sertxd("go north") 'set to go north
exit 'exit loop
elseif b0<b1 then 'compare target to position, if north
sertxd("go south") 'go south
exit 'exit loop
endif 'everything matched!
b13=b13+1
loop until b13=88 'go on to nest significant character
b12=90
do 'test loop for longitude
b12=b13+20
peek b13,b0 'get next target character
peek b12,b1 'set next position character
if b0>b1 then 'compare target to position, if south
sertxd("go east") 'set to go north
exit 'exit loop
elseif b0<b1 then 'compare target to position, if north
sertxd("go west") 'go south
exit 'exit loop
endif 'everything matched!
b13=b13+1
loop until b13=88 'go on to nest significant character
'heading use compass to reallize which way is forward
#error "code not finished"
'output servos to steer
servo 1, 225 'turn left
wait 2 'pause NOTE turn less than 90 degrees
servo 1, 75 'straighten out
servo 1, 225 'turn right
wait 2 'pause NOTE turn less than 90 degrees
servo 1, 75 'straighten out