#include IRsend irsend; const int vertical_right = A4; // Analog input pin that the potentiometer is attached to const int horz_right = A5; const int vertical_left = A0; const int horz_left = A1; long BLIMP_FORWARD = 0xA25D01FE; // these are the same as the TV remote I'm using long BLIMP_BACKWARD = 0xA25D817E; long BLIMP_LEFT = 0xA25D8A75; long BLIMP_RIGHT = 0xA25DB24D; long BLIMP_UP = 0xA25D04FB; long BLIMP_DOWN = 0xA25D7B84; int vert_right_Value = 0; // these are the left and right joysticks on the controller int horz_right_Value = 0; int vert_left_Value = 0; void setup() { Serial.begin(9600); pinMode(13, OUTPUT); // led pin digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); } void loop() { vert_right_Value = analogRead(vertical_right); horz_right_Value = analogRead(horz_right); vert_left_Value = analogRead(vertical_left); // if (Serial.read() != -1) { // for joystick on the right if (vert_right_Value == 1023){ // joystick up, FORWARD irsend.sendNEC(BLIMP_FORWARD, 32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); } if(vert_right_Value == 0){ // joystick down, BACKWARDS irsend.sendNEC(BLIMP_BACKWARD, 32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); } if(horz_right_Value == 1023){ // joystick left, LEFT irsend.sendNEC(BLIMP_LEFT, 32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); } if(horz_right_Value == 0){ // joystick right, RIGHT irsend.sendNEC(BLIMP_RIGHT, 32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); } // for the joystick on the left if(vert_left_Value == 1023){ // joystick up, UP irsend.sendNEC(BLIMP_UP, 32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); } if(vert_left_Value == 0 ){ // joystick down, DOWN irsend.sendNEC(BLIMP_DOWN, 32); digitalWrite(13, HIGH); delay(40); digitalWrite(13, LOW); } }