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;
}