Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. MCF
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    MCF

    @MCF

    4
    Reputation
    33
    Posts
    608
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    MCF Follow

    Best posts made by MCF

    • RE: I can't download mysensors sketch with a raspberry pi3

      I havent' seen but some one had the same probleme on the forum, and found the solution:
      [link text]
      https://forum.mysensors.org/topic/6096/problem-with-mysensor-library-on-arduino-ide-running-on-raspi/8

      now i can download my sketch with the raspberry pi and i'm very hapy!

      posted in General Discussion
      MCF
      MCF
    • RE: probleme with setBatteryInternalVcc(false)

      The problem is resolved, I use the jmodule and I was mistaken on the implementation of analog inputs. Sorry to make topics useless!

      posted in NodeManager
      MCF
      MCF
    • RE: Dimmer sketches - array and multiple PWM led pins

      hi,
      this is what i use for 3 dimmers:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - February 15, 2014 - Bruce Lacey
       * Version 1.1 - August 13, 2014 - Converted to 1.4 (hek)
       *
       * DESCRIPTION
       * This sketch provides a Dimmable LED Light using PWM and based Henrik Ekblad
       * <henrik.ekblad@gmail.com> Vera Arduino Sensor project.
       * Developed by Bruce Lacey, inspired by Hek's MySensor's example sketches.
       *
       * The circuit uses a MOSFET for Pulse-Wave-Modulation to dim the attached LED or LED strip.
       * The MOSFET Gate pin is connected to Arduino pin 3 (LED_PIN), the MOSFET Drain pin is connected
       * to the LED negative terminal and the MOSFET Source pin is connected to ground.
       *
       * This sketch is extensible to support more than one MOSFET/PWM dimmer per circuit.
       * http://www.mysensors.org/build/dimmer
       * 
       * 
       * LISTE DE POINTS:
       * D0  DISPO
       * D1  DISPO
       * D2  IRQ NRF
       * D3  LED1
       * D4  DISPO
       * D5  LED2
       * D6  LED3
       * D7  DISPO
       * D8  DISPO
       * D9  CE NRF
       * D10 CSN/CS NRF
       * D11 MOSI NRF
       * D12 MISO NRF
       * D13 SCK NRF
       * D14 DISPO
       * 
       * 
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      //#define MY_NODE_ID 153 
      
      #include <SPI.h>
      #include <MySensors.h> 
      
      #define SN "BUREAU PARENTS"
      #define SV "1.2"
      
      #define noLEDs 3
      const int LED_Pin[] = {3, 5, 6}; 
      
      #define FADE_DELAY 10  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
      
      static int currentLevel1 = 0;  // Current dim level...
      static int currentLevel2 = 0;  // Current dim level...
      static int currentLevel3 = 0;  // Current dim level...
      
      MyMessage dimmer1Msg(1, V_DIMMER);
      MyMessage light1Msg(1, V_LIGHT);
      MyMessage dimmer2Msg(2, V_DIMMER);
      MyMessage light2Msg(2, V_LIGHT);
      MyMessage dimmer3Msg(3, V_DIMMER);
      MyMessage light3Msg(3, V_LIGHT);
      
      
      /***
       * Dimmable LED initialization method
       */
      void setup()  
      { 
        // LEDS
        // Pull the gateway's current dim level - restore light level upon sendor node power-up
      for (int sensor=1; sensor<=noLEDs; sensor++){
        request( sensor, V_DIMMER );
       }
      
      
      }
      
      void presentation() {
        // Register the LED Dimmable Light with the gateway
       for (int sensor=1; sensor<=noLEDs; sensor++){
       present(sensor, S_DIMMER);
       wait(2);
       }
      
        sendSketchInfo(SN, SV);
      }
      
      /***
       *  Dimmable LED main processing loop 
       */
      void loop() 
      {
      
      
      }
      
      
      
      void receive(const MyMessage &message) {
        if (message.type == V_LIGHT || message.type == V_DIMMER) {
      
          if (message.sensor == 1) {
      
           //  Retrieve the power or dim level from the incoming request message
          int requestedLevel1 = atoi( message.data );
          
          // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
          requestedLevel1 *= ( message.type == V_LIGHT ? 100 : 1 );
          
          // Clip incoming level to valid range of 0 to 100
          requestedLevel1 = requestedLevel1 > 100 ? 100 : requestedLevel1;
          requestedLevel1 = requestedLevel1 < 0   ? 0   : requestedLevel1;
      
            
           fadeToLevel1( requestedLevel1, message.sensor );
          send(light1Msg.set(currentLevel1 > 0 ? 1 : 0)); 
          send(dimmer1Msg.set(currentLevel1) );}
         
          
          
           
         if (message.sensor == 2) {
         //  Retrieve the power or dim level from the incoming request message
          int requestedLevel2 = atoi( message.data );
          
          // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
          requestedLevel2 *= ( message.type == V_LIGHT ? 100 : 1 );
          
          // Clip incoming level to valid range of 0 to 100
          requestedLevel2 = requestedLevel2 > 100 ? 100 : requestedLevel2;
          requestedLevel2 = requestedLevel2 < 0   ? 0   : requestedLevel2;
          
          fadeToLevel2( requestedLevel2, message.sensor );
          send(light2Msg.set(currentLevel2 > 0 ? 1 : 0));
          send(dimmer2Msg.set(currentLevel2) );}
           
          if (message.sensor == 3) {
         //  Retrieve the power or dim level from the incoming request message
          int requestedLevel3 = atoi( message.data );
          
          // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
          requestedLevel3 *= ( message.type == V_LIGHT ? 100 : 1 );
          
          // Clip incoming level to valid range of 0 to 100
          requestedLevel3 = requestedLevel3 > 100 ? 100 : requestedLevel3;
          requestedLevel3 = requestedLevel3 < 0   ? 0   : requestedLevel3;
            
           fadeToLevel3( requestedLevel3, message.sensor );
          send(light3Msg.set(currentLevel3 > 0 ? 1 : 0));
          send(dimmer3Msg.set(currentLevel3) );}
          }
      
          
      }
      
      /***
       *  This method provides a graceful fade up/down effect
       */
      void fadeToLevel1( int toLevel1, int ledid1 ) {
      
        int delta1 = ( toLevel1 - currentLevel1 ) < 0 ? -1 : 1;
        
        while ( currentLevel1 != toLevel1 ) {
          currentLevel1 += delta1;
          analogWrite(LED_Pin[ledid1-1], (int)(currentLevel1 / 100. * 255) );
          wait( FADE_DELAY );
        }
      }
      void fadeToLevel2( int toLevel2, int ledid2 ) {
      
        int delta2 = ( toLevel2 - currentLevel2 ) < 0 ? -1 : 1;
        
        while ( currentLevel2 != toLevel2 ) {
          currentLevel2 += delta2;
          analogWrite(LED_Pin[ledid2-1], (int)(currentLevel2 / 100. * 255) );
          wait( FADE_DELAY );
        }
      }
      void fadeToLevel3( int toLevel3, int ledid3 ) {
      
        int delta3 = ( toLevel3 - currentLevel3 ) < 0 ? -1 : 1;
        
        while ( currentLevel3 != toLevel3 ) {
          currentLevel3 += delta3;
          analogWrite(LED_Pin[ledid3-1], (int)(currentLevel3 / 100. * 255) );
          wait( FADE_DELAY );
        }
      }
      

      it work not too bad, maybe that can help!

      posted in Development
      MCF
      MCF

    Latest posts made by MCF

    • RE: I can't download mysensors sketch with a raspberry pi3

      I havent' seen but some one had the same probleme on the forum, and found the solution:
      [link text]
      https://forum.mysensors.org/topic/6096/problem-with-mysensor-library-on-arduino-ide-running-on-raspi/8

      now i can download my sketch with the raspberry pi and i'm very hapy!

      posted in General Discussion
      MCF
      MCF
    • I can't download mysensors sketch with a raspberry pi3

      Hi,
      I juste bought a rp3, and i wanted to try to install arduino IDE on it. When that was done, i had to fight against the beast to add the mysensors library (arduino 2:1.0.5+dfsg2-4-1).
      It's unusual for my, because ther is no library manager with that arduino ide version.
      Any way, i tryed next to dowload a sketch (working fine with windows), and i had a lot of strange message like that:

      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:321:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/drivers/RF24/RF24.cpp: In function ‘void RF24_csn(bool)’:
      /home/pi/sketchbook/libraries/MySensors/drivers/RF24/RF24.cpp:46:38: error: ‘hwDigitalWrite’ was not declared in this scope
        hwDigitalWrite(MY_RF24_CS_PIN, level);
                                            ^
      /home/pi/sketchbook/libraries/MySensors/drivers/RF24/RF24.cpp: In function ‘void RF24_ce(bool)’:
      /home/pi/sketchbook/libraries/MySensors/drivers/RF24/RF24.cpp:51:38: error: ‘hwDigitalWrite’ was not declared in this scope
        hwDigitalWrite(MY_RF24_CE_PIN, level);
                                            ^
      /home/pi/sketchbook/libraries/MySensors/drivers/RF24/RF24.cpp: In function ‘bool RF24_initialize()’:
      /home/pi/sketchbook/libraries/MySensors/drivers/RF24/RF24.cpp:459:34: error: ‘hwPinMode’ was not declared in this scope
        hwPinMode(MY_RF24_CE_PIN, OUTPUT);
                                        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void stInitTransition()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:94:45: error: ‘hwReadConfigBlock’ was not declared in this scope
                          sizeof(transportConfig_t));
                                                   ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void stInitUpdate()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:124:45: error: expected ‘)’ before ‘PRIu8’
          TRANSPORT_DEBUG(PSTR("TSM:INIT:STATID=%" PRIu8 "\n"),(uint8_t)MY_NODE_ID);
                                                   ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:124:4: note: in expansion of macro ‘TRANSPORT_DEBUG’
          TRANSPORT_DEBUG(PSTR("TSM:INIT:STATID=%" PRIu8 "\n"),(uint8_t)MY_NODE_ID);
          ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:128:61: error: ‘hwWriteConfig’ was not declared in this scope
          hwWriteConfig(EEPROM_NODE_ID_ADDRESS, (uint8_t)MY_NODE_ID);
                                                                   ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void stIDTransition()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:209:40: error: ‘hwMillis’ was not declared in this scope
         _transportToken = (uint8_t)(hwMillis() & 0xFF);
                                              ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void stUplinkUpdate()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:261:43: error: ‘hwMillis’ was not declared in this scope
         _transportSM.lastUplinkCheck = hwMillis();
                                                 ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:265:44: error: expected ‘)’ before ‘PRIu8’
          TRANSPORT_DEBUG(PSTR("TSM:UPL:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
                                                  ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:265:4: note: in expansion of macro ‘TRANSPORT_DEBUG’
          TRANSPORT_DEBUG(PSTR("TSM:UPL:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
          ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void stReadyTransition()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:292:40: error: expected ‘)’ before ‘PRIu8’
        TRANSPORT_DEBUG(PSTR("TSM:READY:ID=%" PRIu8 ",PAR=%" PRIu8 ",DIS=%" PRIu8 "\n"),
                                              ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:292:2: note: in expansion of macro ‘TRANSPORT_DEBUG’
        TRANSPORT_DEBUG(PSTR("TSM:READY:ID=%" PRIu8 ",PAR=%" PRIu8 ",DIS=%" PRIu8 "\n"),
        ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void stFailureTransition()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:342:40: error: expected ‘)’ before ‘PRIu8’
        TRANSPORT_DEBUG(PSTR("TSM:FAIL:CNT=%" PRIu8 "\n"),_transportSM.failureCounter);
                                              ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:342:2: note: in expansion of macro ‘TRANSPORT_DEBUG’
        TRANSPORT_DEBUG(PSTR("TSM:FAIL:CNT=%" PRIu8 "\n"),_transportSM.failureCounter);
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void transportSwitchSM(transportState_t&)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:373:37: error: ‘hwMillis’ was not declared in this scope
        _transportSM.stateEnter = hwMillis(); // save time
                                           ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘uint32_t transportTimeInState()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:378:18: error: ‘hwMillis’ was not declared in this scope
        return hwMillis() - _transportSM.stateEnter;
                        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘bool transportWaitUntilReady(uint32_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:449:38: error: expected ‘)’ before ‘PRIu32’
        TRANSPORT_DEBUG(PSTR("TSF:WUR:MS=%" PRIu32 "\n"), waitingMS); // timeout
                                            ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:449:2: note: in expansion of macro ‘TRANSPORT_DEBUG’
        TRANSPORT_DEBUG(PSTR("TSF:WUR:MS=%" PRIu32 "\n"), waitingMS); // timeout
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:450:30: error: ‘hwMillis’ was not declared in this scope
        uint32_t enterMS = hwMillis();
                                    ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘bool transportCheckUplink(bool)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:472:26: error: ‘hwMillis’ was not declared in this scope
        if (!force && (hwMillis() - _transportSM.lastUplinkCheck) < MY_TRANSPORT_CHKUPL_INTERVAL_MS) {
                                ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:481:43: error: ‘hwMillis’ was not declared in this scope
         _transportSM.lastUplinkCheck = hwMillis();
                                                 ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:485:44: error: expected ‘)’ before ‘PRIu8’
          TRANSPORT_DEBUG(PSTR("TSF:CKU:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
                                                  ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:485:4: note: in expansion of macro ‘TRANSPORT_DEBUG’
          TRANSPORT_DEBUG(PSTR("TSF:CKU:DGWC,O=%" PRIu8 ",N=%" PRIu8 "\n"), _transportConfig.distanceGW,
          ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘bool transportAssignNodeID(uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:503:50: error: ‘hwWriteConfig’ was not declared in this scope
         hwWriteConfig(EEPROM_NODE_ID_ADDRESS, newNodeId);
                                                        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:504:42: error: expected ‘)’ before ‘PRIu8’
         TRANSPORT_DEBUG(PSTR("TSF:SID:OK,ID=%" PRIu8 "\n"),newNodeId); // Node ID assigned
                                                ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:504:3: note: in expansion of macro ‘TRANSPORT_DEBUG’
         TRANSPORT_DEBUG(PSTR("TSF:SID:OK,ID=%" PRIu8 "\n"),newNodeId); // Node ID assigned
         ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:507:45: error: expected ‘)’ before ‘PRIu8’
         TRANSPORT_DEBUG(PSTR("!TSF:SID:FAIL,ID=%" PRIu8 "\n"),newNodeId); // ID is invalid, cannot assign ID
                                                   ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:507:3: note: in expansion of macro ‘TRANSPORT_DEBUG’
         TRANSPORT_DEBUG(PSTR("!TSF:SID:FAIL,ID=%" PRIu8 "\n"),newNodeId); // ID is invalid, cannot assign ID
         ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘bool transportWait(uint32_t, uint8_t, uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:596:36: error: ‘hwMillis’ was not declared in this scope
        const uint32_t enterMS = hwMillis();
                                          ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘uint8_t transportPingNode(uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:612:44: error: expected ‘)’ before ‘PRIu8’
         TRANSPORT_DEBUG(PSTR("TSF:PNG:SEND,TO=%" PRIu8 "\n"), targetId);
                                                  ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:612:3: note: in expansion of macro ‘TRANSPORT_DEBUG’
         TRANSPORT_DEBUG(PSTR("TSF:PNG:SEND,TO=%" PRIu8 "\n"), targetId);
         ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void transportProcessMessage()’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:660:40: error: expected ‘)’ before ‘PRIu8’
        TRANSPORT_DEBUG(PSTR("TSF:MSG:READ,%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%" PRIu8 ",t=%"
                                              ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:660:2: note: in expansion of macro ‘TRANSPORT_DEBUG’
        TRANSPORT_DEBUG(PSTR("TSF:MSG:READ,%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%" PRIu8 ",t=%"
        ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:669:41: error: expected ‘)’ before ‘PRIu8’
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:LEN,%" PRIu8 "!=%" PRIu8 "\n"), payloadLength,
                                               ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:669:3: note: in expansion of macro ‘TRANSPORT_DEBUG’
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:LEN,%" PRIu8 "!=%" PRIu8 "\n"), payloadLength,
         ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:677:42: error: expected ‘)’ before ‘PRIu8’
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:PVER,%" PRIu8 "!=%" PRIu8 "\n"), mGetVersion(_msg),
                                                ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:677:3: note: in expansion of macro ‘TRANSPORT_DEBUG’
         TRANSPORT_DEBUG(PSTR("!TSF:MSG:PVER,%" PRIu8 "!=%" PRIu8 "\n"), mGetVersion(_msg),
         ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:762:53: error: expected ‘)’ before ‘PRIu8’
               TRANSPORT_DEBUG(PSTR("TSF:MSG:FPAR OK,ID=%" PRIu8 ",D=%" PRIu8 "\n"), _transportConfig.parentNodeId,
                                                           ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:762:9: note: in expansion of macro ‘TRANSPORT_DEBUG’
               TRANSPORT_DEBUG(PSTR("TSF:MSG:FPAR OK,ID=%" PRIu8 ",D=%" PRIu8 "\n"), _transportConfig.parentNodeId,
               ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:775:49: error: expected ‘)’ before ‘PRIu8’
            TRANSPORT_DEBUG(PSTR("TSF:MSG:PINGED,ID=%" PRIu8 ",HP=%" PRIu8 "\n"), sender,
                                                       ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:775:6: note: in expansion of macro ‘TRANSPORT_DEBUG’
            TRANSPORT_DEBUG(PSTR("TSF:MSG:PINGED,ID=%" PRIu8 ",HP=%" PRIu8 "\n"), sender,
            ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:789:53: error: expected ‘)’ before ‘PRIu8’
             TRANSPORT_DEBUG(PSTR("TSF:MSG:PONG RECV,HP=%" PRIu8 "\n"),
                                                           ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:789:7: note: in expansion of macro ‘TRANSPORT_DEBUG’
             TRANSPORT_DEBUG(PSTR("TSF:MSG:PONG RECV,HP=%" PRIu8 "\n"),
             ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:881:21: error: ‘hwMillis’ was not declared in this scope
            delay(hwMillis() & 0x3ff);
                           ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘bool transportSendWrite(uint8_t, MyMessage&)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:1001:42: error: expected ‘)’ before ‘PRIu8’
        TRANSPORT_DEBUG(PSTR("%sTSF:MSG:SEND,%" PRIu8 "-%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%"
                                                ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:1001:2: note: in expansion of macro ‘TRANSPORT_DEBUG’
        TRANSPORT_DEBUG(PSTR("%sTSF:MSG:SEND,%" PRIu8 "-%" PRIu8 "-%" PRIu8 "-%" PRIu8 ",s=%" PRIu8 ",c=%"
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:371:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘void transportSetRoute(uint8_t, uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:1065:51: error: ‘hwWriteConfig’ was not declared in this scope
        hwWriteConfig(EEPROM_ROUTES_ADDRESS + node, route);
                                                         ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘uint8_t transportGetRoute(uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:1075:52: error: ‘hwReadConfig’ was not declared in this scope
        result = hwReadConfig(EEPROM_ROUTES_ADDRESS + node);
                                                          ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp: In function ‘int16_t transportSignalReport(char)’:
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:1174:39: error: expected ‘)’ before ‘PRIu8’
        TRANSPORT_DEBUG(PSTR("TSF:SIR:CMD=%" PRIu8 ",VAL=%" PRIu16 "\n"), reportCommand, result);
                                             ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MyTransport.cpp:1174:2: note: in expansion of macro ‘TRANSPORT_DEBUG’
        TRANSPORT_DEBUG(PSTR("TSF:SIR:CMD=%" PRIu8 ",VAL=%" PRIu16 "\n"), reportCommand, result);
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:395:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySplashScreen.cpp: In function ‘void displaySplashScreen()’:
      /home/pi/sketchbook/libraries/MySensors/core/MySplashScreen.cpp:47:4: error: ‘MY_SERIALDEVICE’ was not declared in this scope
          MY_SERIALDEVICE.print(display);
          ^
      /home/pi/sketchbook/libraries/MySensors/core/MySplashScreen.cpp:50:2: error: ‘MY_SERIALDEVICE’ was not declared in this scope
        MY_SERIALDEVICE.println(F(MYSENSORS_LIBRARY_VERSION "\n"));
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:396:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘void _begin()’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:92:18: error: ‘hwWatchdogReset’ was not declared in this scope
        hwWatchdogReset();
                        ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:98:35: error: ‘hwInit’ was not declared in this scope
        const bool hwInitResult = hwInit();
                                         ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:107:7: error: in argument to unary !
        if (!hwInitResult) {
             ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:131:46: error: ‘hwReadConfigBlock’ was not declared in this scope
                          sizeof(controllerConfig_t));
                                                    ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:140:64: error: ‘hwWriteConfig’ was not declared in this scope
        hwWriteConfig(EEPROM_PARENT_NODE_ID_ADDRESS, MY_PARENT_NODE_ID);
                                                                      ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:171:42: error: expected ‘)’ before ‘PRIu8’
        CORE_DEBUG(PSTR("MCO:BGN:INIT OK,TSP=%" PRIu8 "\n"), isTransportReady());
                                                ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:171:2: note: in expansion of macro ‘CORE_DEBUG’
        CORE_DEBUG(PSTR("MCO:BGN:INIT OK,TSP=%" PRIu8 "\n"), isTransportReady());
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:396:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘bool _processInternalMessages()’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:403:13: error: ‘hwReboot’ was not declared in this scope
          hwReboot();
                   ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:409:41: error: expected ‘)’ before ‘PRIu8’
          CORE_DEBUG(PSTR("MCO:PIM:NODE REG=%" PRIu8 "\n"), _coreConfig.nodeRegistered); // node registration
                                               ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:409:4: note: in expansion of macro ‘CORE_DEBUG’
          CORE_DEBUG(PSTR("MCO:PIM:NODE REG=%" PRIu8 "\n"), _coreConfig.nodeRegistered); // node registration
          ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:396:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:416:49: error: ‘hwWriteConfigBlock’ was not declared in this scope
                             sizeof(controllerConfig_t));
                                                       ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘void saveState(uint8_t, uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:499:54: error: ‘hwWriteConfig’ was not declared in this scope
        hwWriteConfig(EEPROM_LOCAL_CONFIG_ADDRESS+pos, value);
                                                            ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘uint8_t loadState(uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:503:53: error: ‘hwReadConfig’ was not declared in this scope
        return hwReadConfig(EEPROM_LOCAL_CONFIG_ADDRESS+pos);
                                                           ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘void wait(uint32_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:509:39: error: ‘hwMillis’ was not declared in this scope
        const uint32_t enteringMS = hwMillis();
                                             ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘bool wait(uint32_t, uint8_t, uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:517:39: error: ‘hwMillis’ was not declared in this scope
        const uint32_t enteringMS = hwMillis();
                                             ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘void doYield()’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:530:18: error: ‘hwWatchdogReset’ was not declared in this scope
        hwWatchdogReset();
                        ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:532:8: error: ‘yield’ was not declared in this scope
        yield();
              ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp: In function ‘int8_t _sleep(uint32_t, bool, uint8_t, uint8_t, uint8_t, uint8_t)’:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:542:33: error: expected ‘)’ before ‘PRIu32’
        CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 ",SMS=%" PRIu8 ",I1=%" PRIu8 ",M1=%" PRIu8 ",I2=%" PRIu8
                                       ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:542:2: note: in expansion of macro ‘CORE_DEBUG’
        CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 ",SMS=%" PRIu8 ",I1=%" PRIu8 ",M1=%" PRIu8 ",I2=%" PRIu8
        ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:396:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:562:42: error: ‘hwMillis’ was not declared in this scope
         const uint32_t sleepEnterMS = hwMillis();
                                                ^
      In file included from /home/pi/sketchbook/libraries/MySensors/MySensors.h:49:0,
                       from BUREAU_PARENTS.ino:68:
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:572:35: error: expected ‘)’ before ‘PRIu32’
          CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 "\n"), sleepingTimeMS);
                                         ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:572:4: note: in expansion of macro ‘CORE_DEBUG’
          CORE_DEBUG(PSTR("MCO:SLP:MS=%" PRIu32 "\n"), sleepingTimeMS);
          ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:633:34: error: expected ‘)’ before ‘PRIi8’
        CORE_DEBUG(PSTR("MCO:SLP:WUP=%" PRIi8 "\n"), result); // sleep wake-up
                                        ^
      /home/pi/sketchbook/libraries/MySensors/MyConfig.h:1815:43: note: in definition of macro ‘DEBUG_OUTPUT’
       #define DEBUG_OUTPUT(x,...)  hwDebugPrint(x, ##__VA_ARGS__) //!< debug
                                                 ^
      /home/pi/sketchbook/libraries/MySensors/core/MySensorsCore.cpp:633:2: note: in expansion of macro ‘CORE_DEBUG’
        CORE_DEBUG(PSTR("MCO:SLP:WUP=%" PRIi8 "\n"), result); // sleep wake-up
        ^
      
      

      i realy don't undersand so if some one had a solution ..... thanks

      posted in General Discussion
      MCF
      MCF
    • RE: Dimmer sketches - array and multiple PWM led pins

      @plantex i never seen that before. do you have a controler? i use domoticz and the last dimming seems to work properly. but it's right that i dont switch off my nodes when they work, i will check that.

      posted in Development
      MCF
      MCF
    • RE: gateway serial and dimmer example

      (if some one can explain how

      Insert Code Here
      

      works, that could be fine too... no laughs please!

      posted in Development
      MCF
      MCF
    • RE: gateway serial and dimmer example

      after hours (days???) of fighting against the machine (rage?), a waf dangerously low, i got a solution... it's not the most acceptable for me, BUT IT WORKS so be it! i just change the sensor ID from 1 to 100, i'm sure that no message could be send or transfert or whatever exepted the one i chose, and trust me it's good to feel the power of the light!! i hope that some one could explain how to understand every details of Mymessage.h , anyway now this is the code...```
      /**

      • The MySensors Arduino library handles the wireless radio link and protocol
      • between your home built sensors/actuators and HA controller of choice.
      • The sensors forms a self healing radio network with optional repeaters. Each
      • repeater and gateway builds a routing tables in EEPROM which keeps track of the
      • network topology allowing messages to be routed to nodes.
      • Created by Henrik Ekblad henrik.ekblad@mysensors.org
      • Copyright (C) 2013-2015 Sensnology AB
      • Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
      • Documentation: http://www.mysensors.org
      • Support Forum: http://forum.mysensors.org
      • This program is free software; you can redistribute it and/or
      • modify it under the terms of the GNU General Public License
      • version 2 as published by the Free Software Foundation.

      • DESCRIPTION
      • The ArduinoGateway prints data received from sensors on the serial link.
      • The gateway accepts input on seral which will be sent out on radio network.
      • The GW code is designed for Arduino Nano 328p / 16MHz
      • Wire connections (OPTIONAL):
        • Inclusion button should be connected between digital pin 3 and GND
        • RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
      • LEDs (OPTIONAL):
        • To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
        • RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
        • TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
        • ERR (red) - fast blink on error during transmission error or recieve crc error

      */

      // Enable debug prints to serial monitor
      #define MY_DEBUG

      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69

      // Set LOW transmit power level as default, if you have an amplified NRF-module and
      // power your radio separately with a good regulator you can turn up PA level.
      #define MY_RF24_PA_LEVEL RF24_PA_MAX

      // Enable serial gateway
      #define MY_GATEWAY_SERIAL

      // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
      #if F_CPU == 8000000L
      #define MY_BAUD_RATE 38400
      #endif

      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      //#define MY_INCLUSION_BUTTON_FEATURE

      // Inverses behavior of inclusion button (if using external pullup)
      //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP

      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60
      // Digital pin used for inclusion mode button
      //#define MY_INCLUSION_MODE_BUTTON_PIN 3

      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300

      // Inverses the behavior of leds
      //#define MY_WITH_LEDS_BLINKING_INVERSE

      // Flash leds on rx/tx/err
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
      //#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
      //#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED

      #include <MySensors.h>

      #define LED_PIN 3 // Arduino pin attached to MOSFET Gate pin
      #define FADE_DELAY 10 // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)

      static int16_t currentLevel = 0; // Current dim level...
      MyMessage dimmerMsg(100, V_DIMMER);
      MyMessage lightMsg(100, V_LIGHT);

      void setup()
      {
      // Setup locally attached sensors
      request( 100, V_DIMMER );
      }

      void presentation()
      {
      // Present locally attached sensors
      // Register the LED Dimmable Light with the gateway
      present( 100, S_DIMMER );
      }

      void loop()
      {
      // Send locally attached sensor data here
      }
      void receive(const MyMessage &message)
      {
      if (message.sensor == 100 ){

      if (message.type == V_LIGHT || message.type == V_DIMMER) {

      //  Retrieve the power or dim level from the incoming request message
      int requestedLevel = atoi( message.data );
      
      // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
      requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
      
      // Clip incoming level to valid range of 0 to 100
      requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
      requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
      
      Serial.print( "Changing level to " );
      Serial.print( requestedLevel );
      Serial.print( ", from " );
      Serial.println( currentLevel );
      
      fadeToLevel( requestedLevel );
      
      // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
      send(lightMsg.set(currentLevel > 0));
      
      // hek comment: Is this really nessesary?
      send( dimmerMsg.set(currentLevel) );
      

      }
      }

      }

      /***

      • This method provides a graceful fade up/down effect
        */
        void fadeToLevel( int toLevel )
        {

      int delta = ( toLevel - currentLevel ) < 0 ? -1 : 1;

      while ( currentLevel != toLevel ) {
      currentLevel += delta;
      analogWrite( LED_PIN, (int)(currentLevel / 100. * 255) );
      delay( FADE_DELAY );
      }
      }

      posted in Development
      MCF
      MCF
    • RE: gateway serial and dimmer example

      @towme hi, this is not a hardware problem, my led stripe is two meter long, and i've checked the mofset with another sketch. The problem for the debug message is that i don't know how to open serial monitor on the gateway connected to the rpy (i use an arduino uno ), so it's hard to check debug message live

      posted in Development
      MCF
      MCF
    • RE: gateway serial and dimmer example

      @plantex just because it's too bad not using those outputs! but you're right, i think i 'll solder one mini pro, and that question will be over!!

      posted in Development
      MCF
      MCF
    • RE: gateway serial and dimmer example

      @plantex hi, my problem is to dimm led on the gateway sketch, because i need to sort messages. i can't find exemples on the forum, it would be very strange than no one did that already!

      posted in Development
      MCF
      MCF
    • RE: Dimmer sketches - array and multiple PWM led pins

      hi,
      this is what i use for 3 dimmers:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - February 15, 2014 - Bruce Lacey
       * Version 1.1 - August 13, 2014 - Converted to 1.4 (hek)
       *
       * DESCRIPTION
       * This sketch provides a Dimmable LED Light using PWM and based Henrik Ekblad
       * <henrik.ekblad@gmail.com> Vera Arduino Sensor project.
       * Developed by Bruce Lacey, inspired by Hek's MySensor's example sketches.
       *
       * The circuit uses a MOSFET for Pulse-Wave-Modulation to dim the attached LED or LED strip.
       * The MOSFET Gate pin is connected to Arduino pin 3 (LED_PIN), the MOSFET Drain pin is connected
       * to the LED negative terminal and the MOSFET Source pin is connected to ground.
       *
       * This sketch is extensible to support more than one MOSFET/PWM dimmer per circuit.
       * http://www.mysensors.org/build/dimmer
       * 
       * 
       * LISTE DE POINTS:
       * D0  DISPO
       * D1  DISPO
       * D2  IRQ NRF
       * D3  LED1
       * D4  DISPO
       * D5  LED2
       * D6  LED3
       * D7  DISPO
       * D8  DISPO
       * D9  CE NRF
       * D10 CSN/CS NRF
       * D11 MOSI NRF
       * D12 MISO NRF
       * D13 SCK NRF
       * D14 DISPO
       * 
       * 
       */
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      //#define MY_NODE_ID 153 
      
      #include <SPI.h>
      #include <MySensors.h> 
      
      #define SN "BUREAU PARENTS"
      #define SV "1.2"
      
      #define noLEDs 3
      const int LED_Pin[] = {3, 5, 6}; 
      
      #define FADE_DELAY 10  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
      
      static int currentLevel1 = 0;  // Current dim level...
      static int currentLevel2 = 0;  // Current dim level...
      static int currentLevel3 = 0;  // Current dim level...
      
      MyMessage dimmer1Msg(1, V_DIMMER);
      MyMessage light1Msg(1, V_LIGHT);
      MyMessage dimmer2Msg(2, V_DIMMER);
      MyMessage light2Msg(2, V_LIGHT);
      MyMessage dimmer3Msg(3, V_DIMMER);
      MyMessage light3Msg(3, V_LIGHT);
      
      
      /***
       * Dimmable LED initialization method
       */
      void setup()  
      { 
        // LEDS
        // Pull the gateway's current dim level - restore light level upon sendor node power-up
      for (int sensor=1; sensor<=noLEDs; sensor++){
        request( sensor, V_DIMMER );
       }
      
      
      }
      
      void presentation() {
        // Register the LED Dimmable Light with the gateway
       for (int sensor=1; sensor<=noLEDs; sensor++){
       present(sensor, S_DIMMER);
       wait(2);
       }
      
        sendSketchInfo(SN, SV);
      }
      
      /***
       *  Dimmable LED main processing loop 
       */
      void loop() 
      {
      
      
      }
      
      
      
      void receive(const MyMessage &message) {
        if (message.type == V_LIGHT || message.type == V_DIMMER) {
      
          if (message.sensor == 1) {
      
           //  Retrieve the power or dim level from the incoming request message
          int requestedLevel1 = atoi( message.data );
          
          // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
          requestedLevel1 *= ( message.type == V_LIGHT ? 100 : 1 );
          
          // Clip incoming level to valid range of 0 to 100
          requestedLevel1 = requestedLevel1 > 100 ? 100 : requestedLevel1;
          requestedLevel1 = requestedLevel1 < 0   ? 0   : requestedLevel1;
      
            
           fadeToLevel1( requestedLevel1, message.sensor );
          send(light1Msg.set(currentLevel1 > 0 ? 1 : 0)); 
          send(dimmer1Msg.set(currentLevel1) );}
         
          
          
           
         if (message.sensor == 2) {
         //  Retrieve the power or dim level from the incoming request message
          int requestedLevel2 = atoi( message.data );
          
          // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
          requestedLevel2 *= ( message.type == V_LIGHT ? 100 : 1 );
          
          // Clip incoming level to valid range of 0 to 100
          requestedLevel2 = requestedLevel2 > 100 ? 100 : requestedLevel2;
          requestedLevel2 = requestedLevel2 < 0   ? 0   : requestedLevel2;
          
          fadeToLevel2( requestedLevel2, message.sensor );
          send(light2Msg.set(currentLevel2 > 0 ? 1 : 0));
          send(dimmer2Msg.set(currentLevel2) );}
           
          if (message.sensor == 3) {
         //  Retrieve the power or dim level from the incoming request message
          int requestedLevel3 = atoi( message.data );
          
          // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
          requestedLevel3 *= ( message.type == V_LIGHT ? 100 : 1 );
          
          // Clip incoming level to valid range of 0 to 100
          requestedLevel3 = requestedLevel3 > 100 ? 100 : requestedLevel3;
          requestedLevel3 = requestedLevel3 < 0   ? 0   : requestedLevel3;
            
           fadeToLevel3( requestedLevel3, message.sensor );
          send(light3Msg.set(currentLevel3 > 0 ? 1 : 0));
          send(dimmer3Msg.set(currentLevel3) );}
          }
      
          
      }
      
      /***
       *  This method provides a graceful fade up/down effect
       */
      void fadeToLevel1( int toLevel1, int ledid1 ) {
      
        int delta1 = ( toLevel1 - currentLevel1 ) < 0 ? -1 : 1;
        
        while ( currentLevel1 != toLevel1 ) {
          currentLevel1 += delta1;
          analogWrite(LED_Pin[ledid1-1], (int)(currentLevel1 / 100. * 255) );
          wait( FADE_DELAY );
        }
      }
      void fadeToLevel2( int toLevel2, int ledid2 ) {
      
        int delta2 = ( toLevel2 - currentLevel2 ) < 0 ? -1 : 1;
        
        while ( currentLevel2 != toLevel2 ) {
          currentLevel2 += delta2;
          analogWrite(LED_Pin[ledid2-1], (int)(currentLevel2 / 100. * 255) );
          wait( FADE_DELAY );
        }
      }
      void fadeToLevel3( int toLevel3, int ledid3 ) {
      
        int delta3 = ( toLevel3 - currentLevel3 ) < 0 ? -1 : 1;
        
        while ( currentLevel3 != toLevel3 ) {
          currentLevel3 += delta3;
          analogWrite(LED_Pin[ledid3-1], (int)(currentLevel3 / 100. * 255) );
          wait( FADE_DELAY );
        }
      }
      

      it work not too bad, maybe that can help!

      posted in Development
      MCF
      MCF
    • RE: gateway serial and dimmer example

      @mfalkvidd hello, i'm sorry to say that, but i don't know how to do.. i try to understand how mysensors work but i really need your help!

      posted in Development
      MCF
      MCF