No announcement yet.

Pass a a device value to arduino (API plugin)

  • Filter
  • Time
  • Show
Clear All
new posts

  • Pass a a device value to arduino (API plugin)

    I'm counting the pulse from my power meter.
    1 pluse = 1Wh
    During the day, arduino count the pulse and pass the value to HS device (SendToHS).
    If for some reason I restart arduino, the pulse counter restart from zero.
    I could store the value in the eprom but a lot of write on eprom will cause the eprom fail.
    So, in variables declaration I added
    boolean arduino_restarted = 1;
    and in the loop
    if (arduino_restarted > 0) {
        pulse_counter = FromHS[1];
        arduino_restarted = 0;
    /// after the code to read the pulse (getpulsein)
    // and arduino_restarted = arduino_restarted +1
    pulse_counter is declared as integer.
    Is possible to pass to arduino (FromHS) an integer or this function is limited to a byte?

    EDIT: SOLVED! Yes, i possible to pass an integer.
    I added the code in a statement "if (IsConnected == true) {
    /*Execute ONLY when HomeSeer is connected*/"
    Now works fine.