

// Controlling real family car by a remote control

// Aug 2013

// for more info see



int ch1 = 5; // Here's where we'll keep our channel values

int ch2 = 6;

int out1 = 8;

int out2 = 9;

int out3 = 10;

int out4 = 11;

int out5 = 2;

int out6 = 3;

boolean gas_operated = false;

boolean brake_operated =false;

int ledpin=13;



unsigned long time;



void setup() {



pinMode(ch1, INPUT); // Input from Reciever channel 1

pinMode(ch2, INPUT); // Input from Reciever channel 2



pinMode(out1, OUTPUT);

pinMode(out2, OUTPUT);

pinMode(out3, OUTPUT);

pinMode(out4, OUTPUT);

pinMode(out5, OUTPUT);

pinMode(out6, OUTPUT);

pinMode(ledpin, OUTPUT);





Serial.begin(9600); // Pour a bowl of Serials - (ha ha ha...)



}



void loop() {

time = millis();

ch1 = pulseIn(5, HIGH, 25000); // Read the pulse width of

ch2 = pulseIn(6, HIGH, 25000); // each channel

Serial.print(time);

Serial.print(";");

Serial.print(ch1);

Serial.print(";");

Serial.print(ch2);

Serial.print(";");

if (ch1>1700 && ch1<2200) {

Serial.print("2500"); // Reciever channel 1 UP signal

digitalWrite(out1, HIGH); // Gas ON - gas piston FWD

gas_operated=true;

}

else if (ch1>1000 && ch1<1400) {

Serial.print("1000"); // Reciever channel 1 DOWN signal

digitalWrite(out2, HIGH); // Brake ON - Brake piston FWD

brake_operated = true;

}

else {

Serial.print("1500"); // Receiver channel 1 IDLE signal

digitalWrite(out1, LOW); // No Gas Off

digitalWrite(out2, LOW); // No Brake Off



// if (brake_operated == true) {

digitalWrite(ledpin, HIGH); // No Brake ON - brake piston BCK

digitalWrite(out5, HIGH); // No Brake ON - brake piston BCK

// delay(1500);

// brake_operated=false;

//digitalWrite(ledpin, LOW); // No Brake off

//digitalWrite(out5, LOW); // No Brake off

//}



//if (gas_operated==true) {

digitalWrite(ledpin, HIGH); // No Gas ON - gas piston BCK

digitalWrite(out6, HIGH); // No Gas ON - gas piston BCK

// delay(1500);

// gas_operated=false;

//digitalWrite(ledpin, LOW); // No Gas off

//digitalWrite(out6, LOW); // No Gas off

//}

}



Serial.print(";");

if (ch2>1700 && ch2<2200) {

Serial.println("2500"); // Reciever channel 2 RIGHT signal

digitalWrite(out3, HIGH);



}

else if (ch2>1000 && ch2<1400) {

Serial.println("1000"); // Reciever channel 2 LEFT signal

digitalWrite(out4, HIGH);

}

else {

Serial.println("1500"); // Reciever channel 2 IDLE signal

digitalWrite(out3, LOW);

digitalWrite(out4, LOW);

}

//delay(50); // I put this here just to make the terminal window happier

} // RC Toyota// Controlling real family car by a remote control// Aug 2013// for more info see Http://www.KeerBot.com int ch1 = 5; // Here's where we'll keep our channel valuesint ch2 = 6;int out1 = 8;int out2 = 9;int out3 = 10;int out4 = 11;int out5 = 2;int out6 = 3;boolean gas_operated = false;boolean brake_operated =false;int ledpin=13;unsigned long time;void setup() {pinMode(ch1, INPUT); // Input from Reciever channel 1pinMode(ch2, INPUT); // Input from Reciever channel 2pinMode(out1, OUTPUT);pinMode(out2, OUTPUT);pinMode(out3, OUTPUT);pinMode(out4, OUTPUT);pinMode(out5, OUTPUT);pinMode(out6, OUTPUT);pinMode(ledpin, OUTPUT);Serial.begin(9600); // Pour a bowl of Serials - (ha ha ha...)void loop() {time = millis();ch1 = pulseIn(5, HIGH, 25000); // Read the pulse width ofch2 = pulseIn(6, HIGH, 25000); // each channelSerial.print(time);Serial.print(";");Serial.print(ch1);Serial.print(";");Serial.print(ch2);Serial.print(";");if (ch1>1700 && ch1<2200) {Serial.print("2500"); // Reciever channel 1 UP signaldigitalWrite(out1, HIGH); // Gas ON - gas piston FWDgas_operated=true;else if (ch1>1000 && ch1<1400) {Serial.print("1000"); // Reciever channel 1 DOWN signaldigitalWrite(out2, HIGH); // Brake ON - Brake piston FWDbrake_operated = true;else {Serial.print("1500"); // Receiver channel 1 IDLE signaldigitalWrite(out1, LOW); // No Gas OffdigitalWrite(out2, LOW); // No Brake Off// if (brake_operated == true) {digitalWrite(ledpin, HIGH); // No Brake ON - brake piston BCKdigitalWrite(out5, HIGH); // No Brake ON - brake piston BCK// delay(1500);// brake_operated=false;//digitalWrite(ledpin, LOW); // No Brake off//digitalWrite(out5, LOW); // No Brake off//}//if (gas_operated==true) {digitalWrite(ledpin, HIGH); // No Gas ON - gas piston BCKdigitalWrite(out6, HIGH); // No Gas ON - gas piston BCK// delay(1500);// gas_operated=false;//digitalWrite(ledpin, LOW); // No Gas off//digitalWrite(out6, LOW); // No Gas off//}Serial.print(";");if (ch2>1700 && ch2<2200) {Serial.println("2500"); // Reciever channel 2 RIGHT signaldigitalWrite(out3, HIGH);else if (ch2>1000 && ch2<1400) {Serial.println("1000"); // Reciever channel 2 LEFT signaldigitalWrite(out4, HIGH);else {Serial.println("1500"); // Reciever channel 2 IDLE signaldigitalWrite(out3, LOW);digitalWrite(out4, LOW);//delay(50); // I put this here just to make the terminal window happier

the control scheme for the project is that the signals from the remote control will received in the car, transferred into the Arduino micro controller and then processed into instructions (pulses) to the valves/Wheel. I wrote an Arduino sketch based on what I found here (at Sparkfun ) and made an addition to print the values to the screen for QA purposes.I had really hard time trying to "clean" the garbage that my RC controller generated (I use an 20 years old transmitter and receiver, that was gives as a gift for my friend for his 10th birthday, it is so old that when you screw all 4 bolts of the casing, the transmitter stops working, if you remove 2 of them - it works again...)I used an Arduino Duemilanova , (borrowed after I blown mine...)The Arduino sketch is below: