As a test, I decided to hack an existing piece of consumer electronic and control it with an Arduino. I took apart my son’s $10 toy RC car and used a wire to contact the battery’s positive terminal to random points on the circuit board until I isolated which circuits control the steering and motor. Once I located these circuits, I soldered wires to these points and connected them to pins on an Arduino.
My Arduino happens to be connected to a PS2 shield, so I made some slight modifications to my PS2 controller sketch to digitalWrite the appropriate pins to HIGH. Here’s the sketch:
#include "Shield_PS2.h" PS2 ps2=PS2(); unsigned long time; int fwPin = 8; int bwPin = 9; void setup() { ps2.init(9600, 2, 3); pinMode(fwPin, OUTPUT); pinMode(bwPin, OUTPUT); Serial.begin(9600); Serial.println("PS2 Shield initialized."); } void loop() { // Button Status: 1 = not pressed, 0 = pressed // SQUARE if (ps2.getval(p_square) == 0) { printTime(); Serial.println("SQUARE"); digitalWrite(bwPin, HIGH); } else { digitalWrite(bwPin, LOW); } // CROSS if (ps2.getval(p_cross) == 0) { printTime(); Serial.println("CROSS"); digitalWrite(fwPin, HIGH); } else { digitalWrite(fwPin, LOW); } } void printTime () { time = millis(); Serial.print("("); Serial.print(time); Serial.print(") "); }