Combining sketchs for IRremote and Joystick servo control


i wondering how combine 2 sketches can control 2 servos using joystick , 2 more servos using remote. have sketch each of them not know how put sketches work

joystick sketch

#include <servo.h>
servo tilt, pan;
int joyx = a0;
int joyy = a1;
int x, y;

void setup() {
  tilt.attach(9);
  pan.attach(10);
}

void loop() {
  x = joyx;
  y = joyy;
  x = map(analogread(joyx), 0, 1023, 900, 2100);




  y = map(analogread(joyy), 0, 1023, 900, 2100);
  tilt.write(x);
  pan.write(y);
  delay(15);
}

irremote sketch

#include <boarddefs.h>
#include <irremote.h>
#include <irremoteint.h>
#include <ir_lego_pf_bitstreamencoder.h>

#include <servo.h>
#include <irremote.h>

unsigned long value1 = 0xff18e7;
unsigned long value2 = 0xff4ab5;
unsigned long value3 = 0xff5aa5 ;
unsigned long value4 = 0xff10ef;

int recv_pin = 11;
irrecv irrecv(recv_pin);
decode_results results;

servo servo1;
servo servo2;

void setup() {
  serial.begin(9600);
  irrecv.enableirin();
  servo1.attach(8);
  servo2.attach(7);
}

void loop() {



Arduino Forum > Using Arduino > Programming Questions > Combining sketchs for IRremote and Joystick servo control


arduino

Comments

Popular posts from this blog

Help with codes to add 1 more shift register and add more to matrix LED

tcp client

Is there an HTML component in Flex 2.0?