Controling DMX with a IR recepter

I don't understand what's wrong with this code, when I put the DMX.simpleWrite command before the IR.enableIRIn(); in the setup. The projector rotates correctly however when it is put after (in the loop or not) nothing works. By the way i'm trying to control a projector via a DMX adapter connected to arduino (Pin 3).

le code :

#include <DmxSimple.h>
#include <IRremote.h>

int hori = 0;
int vert;
int cool;
int form;

String posHori;
String posVert;
String posCool;
String posForm;

int isHori = 0;
int isVert = 0;
int isCool = 0;
int isForm = 0;

IRrecv IR(2);
int ir;

void setup() {

  IR.enableIRIn();  // cette commande bloque le projecteur

  //DmxSimple.usePin(8);  // pas utile (port par defaut)
  Serial.begin(9600);

  DmxSimple.write(9, 255);  // allumes la lumière
}

void loop() {

  if (IR.available()) {
  }
  /*Serial.print("Horizontal (0° à 360°) :  ");
  while (isHori == 0) {
    while (Serial.available() != 0) {
      posHori = Serial.readString();
      //hori = hori + posHori;
      //if (posHori == 10) { isHori = 1; }  // fin transmission msg (si Serial.read)
      isHori = 1;
      posHori.trim();          // enleve la mise a la ligne
      hori = posHori.toInt();  // converti le String en int
      hori = map(hori, 0, 360, 0, 172);
      Serial.println(hori);
    }
  }*/

  /*Serial.print("Vertical   (0° à 280°) :  ");
  while (isVert == 0) {
    while (Serial.available() != 0) {
      posVert = Serial.readString();
      //vert = vert + posVert;
      //if (posVert == 10) { isVert = 1; }  // fin transmission msg (si Serial.read)
      isVert = 1;
      posVert.trim();          // enleve la mise a la ligne
      vert = posVert.toInt();  // converti le String en int
      vert = map(vert, 0, 280, 0, 255);
      Serial.println(vert);
    }
  }*/


  /*if (IR.decode()) {
    //ir = IR.decodedIRData.decodedRawData;
    if (IR.decodedIRData.decodedRawData == 0xFD02BF00) {
      Serial.println("bouton appuyé");
      hori = 128;
    }
    ir = 0;
    IR.resume();
  }*/

  DmxSimple.write(1, 230);
  DmxSimple.write(2, 50);
  DmxSimple.write(6, cool);
  DmxSimple.write(7, form);
  isHori = 0;
  isVert = 0;
  isCool = 0;
  isForm = 0;
  Serial.println(hori);
  Serial.println("***** program send *****");

  delay(10);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.