Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Compile error

Compile error

Scheduled Pinned Locked Moved My Project
7 Posts 3 Posters 1.2k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    carpov
    wrote on last edited by
    #1

    Re: Water Flow sensor

    HI there

    I've got problem with scatch posted above. I've got error after compiling:

    C:\Users\Jacek\Documents\Arduino\libraries\MySensors/MySensors.h:328:2: error: #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
    
     #error No forward link or gateway feature activated. This means nowhere to send messages! Pretty pointless.
    
      ^
    
    exit status 1
    Compile error for Arduino/Genuino Uno.``
    

    `Any ideas?

    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      you need to enable one the following defines

      #define MY_RADIO_NRF24
      //#define MY_RADIO_NRF5_ESB
      //#define MY_RADIO_RFM69
      //#define MY_RADIO_RFM95
      
      1 Reply Last reply
      0
      • C Offline
        C Offline
        carpov
        wrote on last edited by
        #3

        Nothing change to me.
        I put
        #define MY_GATEWAY_SERIAL (I use usb connection)

        Error still occure :(

        1 Reply Last reply
        0
        • gohanG Offline
          gohanG Offline
          gohan
          Mod
          wrote on last edited by gohan
          #4

          wait a second? Are making a gateway without radio or a node?
          check that #define MY_GATEWAY_SERIAL is written before #include <MySensors.h>?

          1 Reply Last reply
          1
          • C Offline
            C Offline
            carpov
            wrote on last edited by
            #5

            Hi there

            Yes I made gateway without radio. I need connect hallefect flow sensor to Domoticz.
            I use Arduino (as node) connected to RPi (controller) via USB cable.

            I already have good working skatch - measure water flow with 5% accuracy. Now I need to add gatewy feature to that sketch.

            I found similar skatch (TESTING SKATCH) in web https://forum.mysensors.org/topic/1282/water-flow-sensor/2
            and I wanted to check this solution. I need only current flow, i don't need counter.

            I checked and change positions of #define MY_GATEWAY_SERIAL and #include <MySensors.h>.
            now MY_GATEWAY is before MySensors.h...............and I have new error

            
            
            sketch_mar26a:17: error: 'MySensor' does not name a type
            
             MySensor gw;
            
             ^
            
            C:\Users\Jacek\Desktop\sketch_mar26a\sketch_mar26a.ino: In function 'void setup()':
            
            sketch_mar26a:26: error: 'gw' was not declared in this scope
            
               gw.begin(); 
            
               ^
            
            C:\Users\Jacek\Desktop\sketch_mar26a\sketch_mar26a.ino: In function 'void loop()':
            
            sketch_mar26a:56: error: 'gw' was not declared in this scope
            
                   gw.send(flowMsg.set(flow));
            
                   ^
            
            exit status 1
            'MySensor' does not name a type```
            
            
            

            And this is my TESTING sketch

            Insert Code Here
            ```#define MY_GATEWAY_SERIAL
            
            #include <SPI.h>
            #include <MySensors.h>  
            
            
            #define DIGITAL_INPUT_SENSOR 3                  // The digital input you attached your sensor.  (Only 2 and 3 generates interrupt!)
            #define SENSOR_INTERRUPT DIGITAL_INPUT_SENSOR-2        // Usually the interrupt = pin -2 (on uno/nano anyway)
            
            #define CHILD_ID 1                              // Id of the sensor child
            
            int READ_INTERVAL = 3;           // Read interval to count the pulses (in seconds). 
            
            long lastReadStart;
            int flow;
            
            MySensor gw;
            MyMessage flowMsg(CHILD_ID,V_FLOW);
            
            
            int READ_INTERVAL_MILLIS=READ_INTERVAL * 1000;        // Just to simple the math!
            volatile unsigned long pulseCount = 0;   
            
            void setup()  
            {  
              gw.begin(); 
            
              // Send the sketch version information to the gateway and Controller
              gw.sendSketchInfo("Water Meter", "1.2");
            
              // Register this device as Waterflow sensor
              gw.present(CHILD_ID, S_WATER);       
            
              pulseCount = 0;
            
              lastReadStart = millis();
            
              attachInterrupt(SENSOR_INTERRUPT, onPulse, RISING);
            }
            
            
            void loop()     
            { 
              unsigned long currentTime = millis();
              
            
              if (currentTime - lastReadStart > READ_INTERVAL_MILLIS)
              {
                flow = pulseCount*60/READ_INTERVAL;  //Need to change here for the G type
                lastReadStart=currentTime;
                 
            
            
                  Serial.print("l/hour:");
                  Serial.println(flow);
                  gw.send(flowMsg.set(flow));
                  
                  pulseCount = 0;
              }
            }
            
            
            void onPulse()
            {
              pulseCount++; 
            }
            1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #6

              That example was written for MySensors 1.5. There is a post with instructions to convert code for MySensors 2.x

              1 Reply Last reply
              1
              • mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #7

                https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                39

                Online

                11.7k

                Users

                11.2k

                Topics

                113.1k

                Posts


                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • MySensors
                • OpenHardware.io
                • Categories
                • Recent
                • Tags
                • Popular