View Single Post
  #1   Spotlight this post!  
Unread 19-02-2004, 15:06
MisterX's Avatar
MisterX MisterX is offline
Alumni
AKA: Mr. X
FRC #0521
Team Role: College Student
 
Join Date: Feb 2003
Rookie Year: 2000
Location: Around
Posts: 486
MisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to beholdMisterX is a splendid one to behold
Thumbs down line seeking help needed

I have this and i know it works but i have 3 digital ins that are set as inputs
rc_dig_in01
rc_dig_in02
rc_dig_in03
they are all optical sensors, i know the optical sensors are working properly becuase i get on and off lights on the operator interface. I just cant seem to "word" the way to get all 3 sensors to work together.
roughly i want tit to work like this

if dig in 1 is on then it should turn left
if dig in 2 is on both motors should dturn equally
if dig in 3 is on then it should turn right

PWM01= left side drive
PWM02= right side drive

... but how do i get the sesors to all work together.
I cant seem to think on how to get them to all work together i tried a switch statement and stacking else if 's i just cant think of how to get it to work.

Code:
if (rc_dig_in02 == 1) {
    pwm01= 200;
    pwm02= 200; 
}
else {
    pwm01= 127;
    pwm02= 127;
}