Navigation

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

    yugoos

    @yugoos

    2
    Reputation
    9
    Posts
    684
    Profile views
    1
    Followers
    0
    Following
    Joined Last Online
    Location Spijkenisse, NL

    yugoos Follow

    Best posts made by yugoos

    • RE: RGB Light, cancel loop?

      I made a ws2812 (neopixel) sketch not to long ago, maybe you can use some or all of the code.
      my loop only contains gw.process() for incomming messages (color, brightness, off).
      I made no loops for color shows because i'm not interested in that but is should not be to difficult to adapt the code, there is however a short colorwhipe (chaser) when changing the strip color

      #include <MySensor.h>
      #include <SPI.h>
      
      #include "Adafruit_NeoPixel.h"
      
      #define NUMPIXELS 4   // Number of connected pixels on a single datapin
      #define PIN 4         // Digital output pin
      
      #define NODE_ID AUTO  //254 for testing purpose
      #define CHILD_ID 0  
      
      
      Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
      long RGB_values[3] = {0,0,0};
      
      MySensor gw;
      
      void setup()
      {
          gw.begin(incomingMessage, NODE_ID, false);
          gw.sendSketchInfo("RGB Node", "1.0");
          gw.present(CHILD_ID, S_RGB_LIGHT);
          strip.begin();
          strip.show(); // Update the strip, to start they are all 'off'
      }
      
      
      void loop()
      {
          gw.process();
      }
      
      void incomingMessage(const MyMessage &message) {
          if (message.type==V_RGB) {
        // starting to process the hex code
              String hexstring = message.getString(); //here goes the hex color code coming from through MySensors (like FF9A00)
              long number = (long) strtol( &hexstring[0], NULL, 16);
              RGB_values[0] = number >> 16;
              RGB_values[1] = number >> 8 & 0xFF;
              RGB_values[2] = number & 0xFF;
      
              colorWipe(Color(RGB_values[0],RGB_values[1],RGB_values[2]), 60);
           }
           
          if (message.type==V_DIMMER) {
            strip.setBrightness(round((2.55*message.getInt())));
            strip.show();
            }
            
          if (message.type==V_LIGHT) {
             if (message.getInt() == 0) {
              strip.clear();
              strip.show();
             }
          }
        
      }
       
      void colorWipe(uint32_t c, uint8_t wait) {
        int i;
       
        for (i=0; i < strip.numPixels(); i++) {
            strip.setPixelColor(i, c);
            strip.show();
            delay(wait);
        }
      }
      
          /* Helper functions */
      
      // Create a 15 bit color value from R,G,B
      uint32_t Color(byte r, byte g, byte b)
      {
        uint32_t c;
        c = r;
        c <<= 8;
        c |= g;
        c <<= 8;
        c |= b;
        return c;
      }
         
      

      It's not the cleanest code but it works for me...

      have fun.

      posted in Troubleshooting
      yugoos
      yugoos

    Latest posts made by yugoos

    • RE: RGB Light, cancel loop?

      I made a ws2812 (neopixel) sketch not to long ago, maybe you can use some or all of the code.
      my loop only contains gw.process() for incomming messages (color, brightness, off).
      I made no loops for color shows because i'm not interested in that but is should not be to difficult to adapt the code, there is however a short colorwhipe (chaser) when changing the strip color

      #include <MySensor.h>
      #include <SPI.h>
      
      #include "Adafruit_NeoPixel.h"
      
      #define NUMPIXELS 4   // Number of connected pixels on a single datapin
      #define PIN 4         // Digital output pin
      
      #define NODE_ID AUTO  //254 for testing purpose
      #define CHILD_ID 0  
      
      
      Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
      long RGB_values[3] = {0,0,0};
      
      MySensor gw;
      
      void setup()
      {
          gw.begin(incomingMessage, NODE_ID, false);
          gw.sendSketchInfo("RGB Node", "1.0");
          gw.present(CHILD_ID, S_RGB_LIGHT);
          strip.begin();
          strip.show(); // Update the strip, to start they are all 'off'
      }
      
      
      void loop()
      {
          gw.process();
      }
      
      void incomingMessage(const MyMessage &message) {
          if (message.type==V_RGB) {
        // starting to process the hex code
              String hexstring = message.getString(); //here goes the hex color code coming from through MySensors (like FF9A00)
              long number = (long) strtol( &hexstring[0], NULL, 16);
              RGB_values[0] = number >> 16;
              RGB_values[1] = number >> 8 & 0xFF;
              RGB_values[2] = number & 0xFF;
      
              colorWipe(Color(RGB_values[0],RGB_values[1],RGB_values[2]), 60);
           }
           
          if (message.type==V_DIMMER) {
            strip.setBrightness(round((2.55*message.getInt())));
            strip.show();
            }
            
          if (message.type==V_LIGHT) {
             if (message.getInt() == 0) {
              strip.clear();
              strip.show();
             }
          }
        
      }
       
      void colorWipe(uint32_t c, uint8_t wait) {
        int i;
       
        for (i=0; i < strip.numPixels(); i++) {
            strip.setPixelColor(i, c);
            strip.show();
            delay(wait);
        }
      }
      
          /* Helper functions */
      
      // Create a 15 bit color value from R,G,B
      uint32_t Color(byte r, byte g, byte b)
      {
        uint32_t c;
        c = r;
        c <<= 8;
        c |= g;
        c <<= 8;
        c |= b;
        return c;
      }
         
      

      It's not the cleanest code but it works for me...

      have fun.

      posted in Troubleshooting
      yugoos
      yugoos
    • RE: Pulse water meter

      Hi koen,

      It sounds like your sketch and domoticz are communicating with each other, somehow domoticz has stored 803 pulses for this sensor and sends it back as last known value.

      I think there is an error in the update sequence.
      Try this:

      1. Power down the sensor
      2. Update the device value
      3. Power up sensor and observe received value from domoticz.

      If there is no change try the above sequence again using different url because it looks wrong to me.

      Json url for counters does not use nvalue and svalue is a single value (in liters for watermeters)
      http://10.0.1.13:8084/json.htm?type=command&param=udevice&idx=290&svalue=27736

      Hope this helps.

      Yuri

      posted in Domoticz
      yugoos
      yugoos
    • RE: Compiling MYSBootloader errors [solved]

      I'm happy to report that my fresh compliled bootloader is working on my network settings.

      I have used Mysensors 1.4 library and included 1.4 mysensors and mysensors/utilities folders in the default makefile as aditional CFLAGS -I parameters

      tested tonight using a nano i found in one of the quadcopters πŸ˜‰
      working like a charm

      cheers,
      yuri
      P.S. changed the subject to [solved]

      posted in Troubleshooting
      yugoos
      yugoos
    • RE: Compiling MYSBootloader errors [solved]

      YAY...I fixed it myself...hopefully

      at some point in troubleshooting all the warnings and errors i thought...could the bootloader source may have been broken when implementing 1.5??
      easy enough to try, so after downloading and linking the 1.4 libs in bootloader subfolder, running make and voila! a new hex-file!!! 😁

      now i have to wait for my new arduino's to test....

      cheers,
      yuri

      posted in Troubleshooting
      yugoos
      yugoos
    • RE: Compiling MYSBootloader errors [solved]

      wow, this is some large complex piece of software...
      way over my head i'm afraid.

      being unable to create a bootloader using my channel/bandwith setting, am i now forced to use the defaults if i want FOTA?

      posted in Troubleshooting
      yugoos
      yugoos
    • RE: Compiling MYSBootloader errors [solved]

      Hi Tekka,

      thanx for replying, i'l give it a go.
      downloading 560MB in 3..2..1..

      what depedencies are you referring to, mysensors libraries or avr/arduino compilers?

      it could take a while to test this as my everyday laptop is linux based and the old windoze box is not that fast...

      thanx,
      yuri

      posted in Troubleshooting
      yugoos
      yugoos
    • RE: Compiling MYSBootloader errors [solved]

      did i post in the wrong board?
      getting a bit desperate here after day's of searching google, feeding options to get compiler happy...no joy so far 😞

      has anyone ever successfully compiled the MYSBootloader and how did you do it?

      i'm sure i'm missing something in the compiler environment (shell variables and/or libraries), i just cannot find what..

      thanx,
      yuri

      posted in Troubleshooting
      yugoos
      yugoos
    • RE: Compiling MYSBootloader errors [solved]

      Some additional info i forgot to mention:

      OS: Linux Mint
      Arduino-IDE: 1.6.5

      tried to compile both MySensors-master and development, errors as shown in compile log.
      tried to use provided avr-gcc in github clone and binaries from IDE, more includes needed but still errors like above

      posted in Troubleshooting
      yugoos
      yugoos
    • Compiling MYSBootloader errors [solved]

      Hi all,

      in my setup i changed the channel of my sketches in myconfig.h to 120 and set the speed to 1Mbps, i set the speed higher to lower the signal even further on a problematic spot in the garden and forcing that node to use a repeater without hardcoding a parent.

      while trying to get FOTA to work (without succes) i realized that maybe the provided MYSbootloader is listining on the default channel/speed and not reaching my gateway.

      am i right do i need a fresh compiled bootloader using these new settings?
      if yes, can anyone please guide me how to compile the bootloader, iαΈΏ getting nothing but errors.

      "avr-gcc" -x c -mno-interrupts -funsigned-char -funsigned-bitfields -DF_CPU=16000000L-Os -fno-inline-small-functions -fno-split-wide-types -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -Wall -mmcu=atmega328p -c -std=gnu99 -MD -MP -MF "MYSBootloader.d" -MT"MYSBootloader.d" -MT"MYSBootloader.o"  -I../libraries/MySensors/ MYSBootloader.c -o MYSBootloader.o
      In file included from MYSBootloader.h:8:0,
                       from MYSBootloader.c:44:
      /usr/lib/avr/include/util/delay.h:95:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed" [-Wcpp]
       # warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
         ^
      /usr/lib/avr/include/util/delay.h: In function β€˜_delay_ms’:
      <command-line>:0:17: error: β€˜Os’ undeclared (first use in this function)
      <command-line>:0:17: note: each undeclared identifier is reported only once for each function it appears in
      /usr/lib/avr/include/util/delay.h: In function β€˜_delay_us’:
      <command-line>:0:17: error: β€˜Os’ undeclared (first use in this function)
      In file included from ../libraries/MySensors/MySensor.h:26:0,
                       from MYSBootloader.h:11,
                       from MYSBootloader.c:44:
      ../libraries/MySensors/MyHw.h: At top level:
      ../libraries/MySensors/MyHw.h:31:1: error: unknown type name β€˜class’
       class MyHw
       ^
      ../libraries/MySensors/MyHw.h:32:1: error: expected β€˜=’, β€˜,’, β€˜;’, β€˜asm’ or β€˜__attribute__’ before β€˜{’ token
       { 
       ^
      In file included from ../libraries/MySensors/MySensor.h:27:0,
                       from MYSBootloader.h:11,
                       from MYSBootloader.c:44:
      ../libraries/MySensors/MyTransport.h:32:1: error: unknown type name β€˜class’
       class MyTransport
       ^
      ../libraries/MySensors/MyTransport.h:33:1: error: expected β€˜=’, β€˜,’, β€˜;’, β€˜asm’ or β€˜__attribute__’ before β€˜{’ token
       {
       ^
      In file included from ../libraries/MySensors/utility/RF24.h:18:0,
                       from ../libraries/MySensors/MyTransportNRF24.h:26,
                       from ../libraries/MySensors/MySensor.h:28,
                       from MYSBootloader.h:11,
                       from MYSBootloader.c:44:
      ../libraries/MySensors/utility/RF24_config.h:17:23: fatal error: WProgram.h: No such file or directory
        #include <WProgram.h>
                             ^
      compilation terminated.
      make: *** [MYSBootloader.o] Error 1
      

      Lot's of syntax errors suggesting the compiler does not understand C++, changing the compiler to avr-cpp or avr-g++ is not helping...

      what am i doing wrong??

      thanx,
      yuri

      posted in Troubleshooting
      yugoos
      yugoos