|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
|||
|
|||
|
Hm, yeah, that's what I was afraid of...
Ok, here's my problem: I need some way to do timed output, i.e. output voltage for a certain amount of time only. I'm writing a program for a steering wheel. So when you move the joystick right, it turns right. When you move the joystick left, it turns left. I kind of have it working, but the problem I'm having is that I can't control HOW MUCH the motor (that turns the wheel) turns. I was thinking of using PWM and use its cycles argument to time it...but I guess that won't work. So, how would I be able to do this? This is my current code - it is modified from the default program: 'Beginning stuff p1_x_old VAR BYTE PWM2 VAR BYTE p1_x_old = p1_X PWM2 = 127 Mainloop: 'SERIN, etc 'My code follows IF ABS (p1_x_old - p1_x) < 2 THEN skip2 IF p1_x_old < p1_x THEN skip1 PWM2 = 200 p1_x_old = p1_x GOTO skip3 skip1: PWM2 = 60 p1_x_old = p1_x GOTO skip3 skip2: PWM2 = 127 skip3: 'limits, SEROUT, etc GOTO Mainloop I know I've got a bit of a logic error (i.e. it doesn't take into account how much the joystick moved), but I think I'll be able to solve that once I can get a timed output Or would a joystick-dependent voltage be the answer here?Thanks!! Diego |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PBASIC ARCTAN function | Greg Ross | Programming | 14 | 11-05-2003 12:28 |
| Obscure PBASIC for RoboEmu | rbayer | Programming | 1 | 28-03-2003 23:57 |
| PBasic 2.5 vs. 2.0 | Anthony Kesich | Programming | 6 | 09-02-2003 22:06 |
| Diagrams for wiring of 15 and 25 pin connectors | archiver | 2000 | 2 | 23-06-2002 23:03 |
| Subtotaling in PBASIC? | Ian W. | Programming | 17 | 02-02-2002 20:22 |