Hello,
I researched the issue on this forum and found several post, but no solution. What I doing in my code is: I am using an IR remote to control two procedures. One procedure is to simply use the channel and volume buttons to control the robot. This works. The other procedure is to make the robot follow a line. When the software begins, the servos are off. Pressing and holding the power button on the remote puts it in line following mode. releasing the power button, send it back to remote control with the IR remote. The problem I am having is that with the 08M the code works flawless. With the 08M2, the servos jitter. Attached is the code:
I researched the issue on this forum and found several post, but no solution. What I doing in my code is: I am using an IR remote to control two procedures. One procedure is to simply use the channel and volume buttons to control the robot. This works. The other procedure is to make the robot follow a line. When the software begins, the servos are off. Pressing and holding the power button on the remote puts it in line following mode. releasing the power button, send it back to remote control with the IR remote. The problem I am having is that with the 08M the code works flawless. With the 08M2, the servos jitter. Attached is the code:
Code:
symbol CH_1 = 0
symbol CH_2 = 1
symbol POWER = 21
symbol KEY_UP = 16
symbol KEY_DOWN = 17
symbol KEY_LEFT = 18
symbol KEY_RIGHT = 19
Main:
pause 10
servo 1,OFF
servo 2,OFF
infrain2
if b13 is POWER then FOLLOW
CONTROL:
select case b13
case KEY_UP
servo 1,225
servo 2,75
goto MAIN
case KEY_DOWN
servo 1,75
servo 2,225
goto MAIN
case KEY_LEFT
servo 1,225
servo 2,225
goto MAIN
case KEY_RIGHT
servo 1,75
servo 2,75
goto MAIN
end select
goto MAIN
FOLLOW:
readadc 4,b1
if b1 > 140 then right 'on average 135 is white, and 210 is black
' 140 works really well in bright rooms
LEFT:
servo 2,OFF
servopos 1,225
pause 10
goto MAIN
RIGHT:
servo 1,OFF
servopos 2,75
pause 10
goto MAIN
goto MAIN