Compile error
-
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?
-
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
-
Nothing change to me.
I put
#define MY_GATEWAY_SERIAL (I use usb connection)Error still occure
-
wait a second? Are making a gateway without radio or a node?
check that #define MY_GATEWAY_SERIAL is written before #include <MySensors.h>?
-
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 errorsketch_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++; }
-
That example was written for MySensors 1.5. There is a post with instructions to convert code for MySensors 2.x
-
Suggested Topics
-
Welcome
Announcements • • hek