|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||||
|
|||||
|
What I have done in the past is quite different than your approach. Two years ago, while writing an auto-balancing routine, and last year for our gear-switching routine, I used an entirely seperate serin/serout loop. This is a sketch of what it might look like, if you were to set the motors to go forward for, say, 40 loops of time. Let us then assume that after 40 loops, it goes back to human control and your regular default program loop, called mainloop.
loopcnt var byte 'a byte to count loops by loopcnt = 0 autoloop: 'our loop for autonomy serin 'this takes data from sensors, get the right syntax from the default program. PWM1 = 254 PWM2 = 254 loopcnt = loopcnt + 1 if loopcnt = 40 then mainloop serout 'this sends data to relays and speed controllers. get syntax from default program goto autoloop I would not bother with the middle man of your joystick variables, p2_x and p2_y. Simply go straigt to your motor output variables, PWM#, or whatever meaningful alias you would give to them. The default program does warn against having more than one serin statement. It is okay as long as they are in seperate loops. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What Should Be Done With Autonomous? | xavior06 | FRC Game Design | 91 | 28-04-2005 19:00 |
| How do you approach your animation? | Koko Ed | 3D Animation and Competition | 7 | 27-01-2003 21:42 |
| Autonomous Period | Andy Grady | General Forum | 73 | 20-01-2003 21:34 |
| EduRobot autonomy | dlavery | Robotics Education and Curriculum | 3 | 02-12-2002 10:08 |
| Proactive approach to scoring dilemmas | reisser | 3D Animation and Competition | 0 | 02-07-2002 21:54 |