/* VEX Remote - Test 1 Vex output to input pin 10 on Arduino Displays the channels and their corresponding values Dan Kohn 10/12/2010 */ unsigned long duration; unsigned long q[7]; void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: pinMode(10, INPUT); pinMode(13, OUTPUT); Serial.begin(9600); } void loop() { digitalWrite(13, LOW); // set the LED on do // wait for long sync pulse { duration = pulseIn(10,LOW); } while(duration < 7000); for (int x=1; x<=6; x++) // read 6 valid readings and store in q[1]..q[6] { duration=pulseIn(10,LOW); q[x]=duration; } for (int x=1; x<=6; x++) //display readings { Serial.print(x); Serial.print(":\t"); Serial.print(q[x]); Serial.print("\t"); } Serial.print("\n"); digitalWrite(13, HIGH); // set the LED off delay(200); }