|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
|||||
|
|||||
|
What you should do in instances like this is write psuedo-code in english. You should try this:
If the middle sensor is on, then I want to go straight. If only the left sensor is on, then I want to turn left. If only the right sensor is on, then I want to turn right. If no sensors are on, then spin in a circle. Now, go on to write your code: If (rc_sw2) then gostraight If (rc_sw1)&(rc_sw3 = 0) then turnleft If (rc_sw3)&(rc_sw1 = 0) then turnright goto turnleft gostraight: p1_x = 127 p1_y = 200 'random forward speed, should be tested on bot goto restofcode turnleft: p1_x = 84 p1_y = 127 goto restofcode turnright: p1_x = 200 p1_y = 127 restofcode: ... ... ... serout ... |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A better autonomous method.. | randomperson | Programming | 4 | 24-02-2004 18:02 |
| Electrical componenets for autonomous navigation | maclaren | Electrical | 10 | 18-12-2003 02:28 |
| crazy idea for autonomous | Mike Ciance | Programming | 16 | 24-04-2003 21:50 |
| autonomous mode problem on field | Chris_C | Programming | 17 | 26-03-2003 19:11 |
| Autonomous Kill Switch | UCGL_Guy | Programming | 8 | 15-01-2003 17:39 |