IR sender & Repeater combined help



  • Hi , I am trying to combine IR sender with Repeater node ( usb powered ) on a Nano
    but anytime I add gw.begin it will not start at all
    gw.begin(incomingMessage,30, true);
    when i change to NULL
    gw.begin(NULL,30, true);

    it will start, but then it will not respond to the gw commands ( I can see it receives the command )


    // Example sketch showing how to create a node thay repeates messages
    // from nodes far from gateway back to gateway.
    // It is important that nodes that has enabled repeater mode calls
    // gw.preocess() frequently. This node should never sleep.

    #include <MySensor.h>
    #include <SPI.h>
    #include <IRremote.h>

    IRsend irsend;

    unsigned int Signal_0_0[] = {4372,4416,528,1636,528,1640,524,1640,528,1640,524,560,524,556,524,1640,528,556,524,556,524,560,524,556,524,556,528,1636,528,}; //AnalysIR Batch Export (IRremote) - RAW
    unsigned int Signal_1_1[] = {4372,4416,524,1640,528,1640,528,1636,528,1640,528,556,524,556,524,1640,528,556,528,552,528,556,524,556,524,556,528}; //AnalysIR Batch Export (IRremote) - RAW
    int khz=38;

    #define CHILD_1 3 // childId
    MySensor gw;
    MyMessage msg(CHILD_1, V_VAR1);

    void setup()
    {
    // The third argument enables repeater mode.
    gw.begin(incomingMessage,30, true);

    //Send the sensor node sketch version information to the gateway
    gw.sendSketchInfo("Repeater Node& IR", "1.0");
    gw.present(CHILD_1, S_LIGHT);
    }

    void loop()
    {
    // By calling process() you route messages in the background
    gw.process();
    }

    void incomingMessage(const MyMessage &message) {
    // We only expect one type of message from controller. But we better check anyway.

    if (message.type==V_LIGHT) {
    int incomingRelayStatus = message.getInt();
    if (incomingRelayStatus == 1) {

      irsend.sendRaw(Signal_1_1, sizeof(Signal_1_1)/sizeof(int), khz); // Vol up yamaha ysp-900
     } else {
      irsend.sendRaw(Signal_0_0, sizeof(Signal_0_0)/sizeof(int), khz);// Vol down yamaha ysp-900
     }
    

    }
    }


  • Code Contributor

    What are you using to send messages to the node? Could you post the serial output?



  • @celonunes
    if this is specified, then there is no output for some reason
    gw.begin(incomingMessage,30, true);

    if I specify NULL then i get this
    repeater started, id 30
    send: 30-30-128-0 s=255,c=0,t=18,pt=0,l=5,st=fail:1.4.1
    send: 30-30-128-0 s=255,c=3,t=6,pt=1,l=1,st=fail:128
    send: 30-30-128-0 s=255,c=3,t=11,pt=0,l=13,st=fail:Repeater Node
    send: 30-30-128-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0
    send: 30-30-128-0 s=3,c=0,t=3,pt=0,l=5,st=fail:1.4.1

    It does seem to receive ( I send using mqtt )
    command on mosquitto :
    mosquitto_pub -t sensor/30/3/V_LIGHT -m 0 -d

    I can see its received on serial
    read: 0-0-30 s=3,c=1,t=2,pt=0,l=1:0

    ..... any help appreciated



  • reflash eprom and i can verify
    gw.begin(incommingmessage,AUTO, true); will always result in sensor not starting at all( no serial out)
    but
    gw.begin(NULL,AUTO, true); will work and will receive messages

    repeater started, id 24
    send: 24-24-0-0 s=255,c=0,t=18,pt=0,l=5,st=ok:1.4.1
    send: 24-24-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
    read: 0-0-24 s=255,c=3,t=6,pt=0,l=1:M
    send: 24-24-0-0 s=255,c=3,t=11,pt=0,l=13,st=ok:Repeater Node
    send: 24-24-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
    send: 24-24-0-0 s=3,c=0,t=3,pt=0,l=5,st=ok:1.4.1
    read: 22-22-255 s=255,c=3,t=7,pt=0,l=0:
    send: 24-24-22-22 s=255,c=3,t=8,pt=1,l=1,st=ok:1
    read: 22-22-0 s=255,c=0,t=17,pt=0,l=5:1.4.1
    send: 22-24-0-0 s=255,c=0,t=17,pt=0,l=5,st=ok:1.4.1
    read: 22-22-0 s=255,c=3,t=6,pt=1,l=1:24


  • Code Contributor

    Strange. Did you tried to remove everything that is not related to mysensors from the sketch? Keep only the essentials, just to see if it works.



  • yea.. as long as this is there it will totally fail
    gw.begin(incommingmessage,AUTO, true)

    i will try with the dev branch and let know result



  • hmmm
    any sketch in dev gets me these
    /Volumes/1TB Audio/Users/audio/Documents/Arduino/libraries/MySensors/MySensor.cpp:81: error: 'eeprom_update_byte' was not declared in this scope
    /Volumes/1TB Audio/Users/audio/Documents/Arduino/libraries/MySensors/MySensor.cpp:94: error: 'eeprom_update_byte' was not declared in this scope
    /Volumes/1TB Audio/Users/audio/Documents/Arduino/libraries/MySensors/MySensor.cpp: In member function 'boolean MySensor::process()':


  • Code Contributor

    Are you using the latest version of Arduino IDE? (1.6.0)



  • yes I am
    I also replaced libs to Iremote and have same problem
    basically as long as there is sendRaw command and incomingMessage in the same sketch, it will not work....
    this seems like something wrong with incommingMessage, because send raw on itself works and I have tried both IRlibraries
    any suggestion?

    // Example sketch showing how to control physical relays.
    // This example will remember relay state even after power failure.

    #include <MySensor.h>
    #include <SPI.h>
    #include <IRLib.h>

    #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    unsigned int Signal_0_0[] = {4372,4416,528,1636,528,1640,524,1640,528,1640,524,560,524,556,524,1640,528,556,524,556,524,560,524,556,524,556,528,1636,528,1640,528,556,524,1640,528,556,524,556,524,556,528,556,524,556,528,552,528,1636,528,1640,528,1636,528,1640,528,1640,524,1640,528,1640,524,1640,528,556,524,556,528,556,524,556,524,560,524,556,528,552,528,552,528,556,524,1640,528,1636,528,1644,524,556,524,556,528,556,524,556,524,556,528,556,524,556,524,560,524,556,524,556,528,556,524,1640,524,1640,528,1640,528,556,524,556,524,560,524,556,524,556,528,556,524,556,524,556,528,1636,528,1640,528,556,524,556,528,552,528,1640,524,1640,528,556,524,5288,4376,4412,528,1640,524,1640,528,1640,524,1640,528,556,524,556,528,1636,528,556,524,560,524,556,524,556,528,556,524,1636,528,1640,528,556,524,1640,528,556,524,556,528,556,524,556,524,556,528,556,524,1640,528,1636,528,1640,528,1640,524,1640,528,1636,528,1640,528,1640,524,556,528,556,524,556,524,556,528,556,524,556,528,552,528,556,524,556,528,1636,528,1640,528,1636,528,556,528,556,524,556,524,556,528,556,524,556,528,556,524,556,524,556,528,556,524,556,528,1636,528,1640,528,1636,528,556,524,556,528,556,524,556,528,552,528,556,524,556,528,556,524,1640,528,1636,532,552,528,556,524,556,524,1640,528,1640,524,556,528}; //AnalysIR Batch Export (IRremote) - RAW
    unsigned int Signal_1_1[] = {4372,4416,524,1640,528,1640,528,1636,528,1640,528,556,524,556,524,1640,528,556,528,552,528,556,524,556,524,556,528,1636,528,1640,528,560,520,1640,528,556,524,556,524,556,528,556,524,556,524,560,524,1640,524,1640,528,1636,528,1640,528,1640,524,1640,528,1640,524,1640,528,556,524,556,532,552,524,556,524,556,528,556,524,556,528,552,528,556,524,1640,528,1640,524,1640,528,556,524,556,528,556,524,556,528,552,528,556,524,556,528,556,524,556,524,556,528,556,524,556,528,1636,528,1640,528,556,524,556,524,556,528,556,524,556,528,552,528,556,524,556,528,1636,528,1640,528,556,524,556,524,556,528,556,524,1640,528,556,524,5404,4372,4412,528,1640,528,1636,528,1640,528,1636,528,556,528,556,524,1640,524,556,528,556,524,556,528,556,524,556,524,1640,528,1636,528,556,528,1636,528,556,528,556,524,556,524,556,528,556,524,556,528,1636,528,1640,528,1636,528,1640,528,1636,528,1640,528,1636,528,1640,528,556,524,556,524,556,528,556,524,556,528,552,528,556,524,556,528,556,524,1640,528,1636,528,1640,528,552,528,556,524,556,528,556,524,556,528,556,524,556,524,556,528,556,524,556,528,552,528,556,524,1640,528,1636,528,556,528,552,528,556,524,556,528,556,524,556,528,552,528,556,524,1640,528,1640,524,556,528,556,524,556,528,552,528,1636,528,556,528}; //AnalysIR Batch Export (IRremote) - RAW
    int khz=38;
    int longs=295;

    IRsend irsend;

    MySensor gw;

    void setup()
    {
    // Initialize library and add callback for incoming messages
    gw.begin( incomingMessage , 30, true);
    // Send the sketch version information to the gateway and Controller
    gw.sendSketchInfo("IR Sensor", "1.0");

    gw.present(RELAY_1, S_LIGHT);
    }

    void loop()
    {
    // Alway process incoming messages whenever possible
    gw.process();
    }

    void incomingMessage(const MyMessage &message) {
    // We only expect one type of message from controller. But we better check anyway.
    if (message.type==V_LIGHT && message.sensor == 3) {
    int incomingRelayStatus = message.getInt();
    if (incomingRelayStatus == 1) {
    irsend.IRsendRaw::send(Signal_1_1, longs, khz); // Vol up yamaha ysp-900
    } else {
    irsend.IRsendRaw::send(Signal_0_0, longs, khz); // Vol down yamaha ysp-900
    }

    }
    }


Log in to reply
 

Suggested Topics

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts