dual control rc and arduino without a switch
i had made an airsoft tank and wanted it both to freeroam and be controlled by rc. and found it to be quite simple actualy using the ping code. this is just the begining of the code but the robot will nagigate with ping and when the rx is switched on will stop the arduino. and when switched off will let it continue. i did this using an unused channel on the rx. when the rx is swithed on but the tx is not it sends out no pulses but when the tx is switched on its send pulses high then a servos range. using the ping code it reads at 17 inches. so modding the ping code. when it reads from sensor 2 (the rx) a 17 inch signal it delays the arduino allowing rc control. my only problem is getting the arduino to start again
const int pingPin = 7;
const int rxPin = 4;
void setup() {
// initialize serial communication:
Serial.begin(9600);
}
void loop()
{
long duration, duration2, inches, inches2;
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);//ping input read
duration = pulseIn(pingPin, HIGH);
pinMode(rxPin, INPUT);//rx input read
duration2 = pulseIn(rxPin, HIGH);
inches = microsecondsToInches(duration); //ping input
inches2 = microsecondsToInches(duration2);//rx input
Serial.print(inches);
Serial.print("in, ");
Serial.print(inches2);
Serial.print("rx 17=on ");
Serial.println();
delay(150);
while(inches2 >= 17){//will stop the arduino while the tx is on but when tx is turned off does not continue
delay(10);
}
}
long microsecondsToInches(long microseconds)
{
return microseconds / 74 / 2;
}



@ Mon, 2010-02-01 22:49
So could you just mod your
So could you just mod your RC remote so that you can us a toggle switch instead of a momentary for the rx input? That way you toggle and continually transmit on that channel when you want to use RC. Switch the toggle back off and you go to autonomous mode.
I guess it might be a drain on the RC remote batteries to continuosly transmit.