|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
Switch with Servo
I was wondering i there was anyway to program a servo to be activated on a rocker switch instead of with a petentiometer, such as have it rotate 180 degrees or something?
|
|
#2
|
||||
|
||||
|
servo = 127
if sw1 = 1 then servo = 254 if sw2 = 1 then servo = 0 |
|
#3
|
|||||
|
|||||
|
you're positive this would work? i've been argueing with our programmer that it is possible.
|
|
#4
|
|||||
|
|||||
|
Quote:
Quote:
If you would rather have the servo only go from one extreme to the other, you might want something more like this: Code:
servo = 0 main_loop: ... if sw1 = 1 then servo = 254 if sw2 = 1 then servo = 0 |
|
#5
|
|||||
|
|||||
|
YEP...
We used just that to activate a "brake" pin in our gearboxes last year....works fine... |
|
#6
|
|||||
|
|||||
|
Quote:
|
|
#7
|
|||||
|
|||||
|
we're using a rocker switch. Right now the code we have is this:
p1_wheel = 0 if p3_sw_aux2 = 0 then p1_wheel = 0 if p3_sw_aux2 = 1 then p1_wheel = 63 since the servo is on PWM 9 we're using p1_wheel variable, but yusing the roboemu program, the wheel on the joystick moves the server but not aux2, any help would be appreciated. Last edited by pras870 : 10-03-2003 at 15:55. |
|
#8
|
||||||
|
||||||
|
Quote:
If you email me your code, I'd be happy to take a look. RoboEmu doesn't currently have any known issues that would affect code like the stuff you posted, so it's probably a line somewhere farther down overriding your code. Anyways, let me know. rob-bayer@mn.rr.com |
|
#9
|
|||||
|
|||||
|
I also found out today that any wheel on a joystick controls p1_wheel, it's strange if you ask me.
|
|
#10
|
|||||
|
|||||
|
Quote:
There's just not enough info to go on here. I suggest you do as Rob suggests, and send him your code. Better yet, post it here, and you can have a bunch more pair of eyes looking at it at the same time. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| spike for pressure switch? | Rob Colatutto | Rules/Strategy | 4 | 23-02-2003 15:42 |
| Using a switch before autonomous operation | KZos550 | Programming | 11 | 04-02-2003 19:12 |
| NEED HELP with Delay loop for compressor relay switch | archiver | 2001 | 10 | 24-06-2002 02:11 |
| Changing gears | archiver | 2000 | 1 | 23-06-2002 23:26 |
| Error found in programming for the pump and pressure switch | sjharobotics | Programming | 4 | 06-02-2002 17:46 |