Muzakyo, I don't see where the motor is commanded to stop.. Must operate like a windshield wiper unless it's asleep?
Dave Purola,
N8NTA
Muzakyo, I don't see where the motor is commanded to stop.. Must operate like a windshield wiper unless it's asleep?
Dave Purola,
N8NTA
i am a newbie in pic......
but from the proramming the motor will run for a certain time (100 miliseconds) and then it will get back in the start loop....
for the motor i am not sure.... but when i compile it there are no problems.
did i need to do like the slp: programming..?
for this program i refer to the pic microcontroller project book by John Iovine and pic robotic : a beginner's guide to robotic by john iovine... (first post)
muzakyo, I don't see anywhere in your code that you are stopping the motor if your system is "on target". You need to place some kind of DEAD BAND limits that are within the ON TARGET criteria. I mean +- so many counts... You should have at least 4 states, 1 for sleep (waiting for next morning), 1 for going east, 1 for going west and 1 for stop during the day when system is on target.
Dave Purola,
N8NTA
sorry my lack of knowledge....
for the system when the system are on the target is
skp:
if v1 = v2 then start 'If equal, do nothing
it will go back to the start..... then it will never give output to the motor (so motor will not rotate anywhere) until one of the cds value higher than other.
so to stop the motor when it run
cw: 'Turn the sensor array clockwise
high portc.0 'Turn on h-bridge
pause 100 'Let it turn for a moment
low portc.0 'turn off the h-bridge
goto start 'Check again
what do u think....
can u give idea how to improve this proramming
muzakyo, Yes that is more resonable.... Just don't forget to do the same for the other direction as well...
Dave Purola,
N8NTA
muzakyo, I found this .txt file I saved from a couple of years ago. I thought you might be interested because it looks like the same code you are trying to use but has been modified since your version.... Enjoy...
Hmm, I took a look at the code, but see no check to stop the motors when in a balance of the sensors (if they were moving).
Maybe this will help:
This is an idea, not tested.Code:greater: 'greater routine b2 = b0 - b1 'find the difference if b2 > 10 then cw 'is it within the range? if not go to clockwise/ solar panel facing west low PORTB.0 'pin portb.0 low /stopping the solar panel for moving low PORTB.1 'pin portb.1 low / stopping the solar panel for moving goto start 'if it is in the range,do it again lesser: 'lesser routine b2 = b1 - b0 'find the difference if b2 > 10 then ccw 'is it within the range? if not got counter clockwise/solar panel facing east low PORTB.0 'pin portb.0 low /stopping the solar panel for moving low PORTB.1 'pin portb.1 low / stopping the solar panel for moving goto start 'if it is in the range, do it again
Ioannis
Bookmarks