How to great variables
-
I'm running a MyController v 2.0 server on Rasp Pi v4. The server is setup on a DDNS so that I can send data from gateways and notes in remote locations back to the server and gain access world wide. I have had some success using the available MySensors example sketches in Adruino libraries in getting the BME680, for example, connected and transmitting data, but I am trying to add in other Adafruit boards and am getting cought up on defining the variables. As an example, I noticed that the BME680 has a gas sensor along with temp, press, and humidity. So, using the available example, I tried to create a variable for the gas value AND for the two values that are available on the CCS811 board as follows:
//create mysensors varibles, send as V_custom not as a JSON MyMessage temperatureMSG(TEMP_CHILD_ID, V_TEMP); MyMessage humidityMSG(HUM_CHILD_ID, V_HUM); MyMessage pressureMSG(BARO_CHILD_ID, V_PRESSURE); MyMessage gasMSG(GAS_CHILD_ID, V_GAS); MyMessage coMSG(CO_CHILD_ID, V_CO); MyMessage tvocMSG(TVOC_CHILD_ID, V_TVOC);
But, I get the error (FYI, I cut most of the top of the compiling log believing it is not helpful here):
Using library MySensors at version 2.3.2 in folder: /Users/bjw58994/Documents/Arduino/libraries/MySensors Using library SPI at version 1.0 in folder: /Users/bjw58994/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/SPI Using library ESP8266WiFi at version 1.0 in folder: /Users/bjw58994/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266WiFi Using library EEPROM at version 1.0 in folder: /Users/bjw58994/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/EEPROM Using library Wire at version 1.0 in folder: /Users/bjw58994/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/Wire Using library Adafruit Unified Sensor at version 1.1.14 in folder: /Users/bjw58994/Documents/Arduino/libraries/Adafruit_Unified_Sensor Using library Adafruit BME680 Library at version 2.0.4 in folder: /Users/bjw58994/Documents/Arduino/libraries/Adafruit_BME680_Library Using library Adafruit BusIO at version 1.15.0 in folder: /Users/bjw58994/Documents/Arduino/libraries/Adafruit_BusIO Using library Adafruit CCS811 Library at version 1.1.3 in folder: /Users/bjw58994/Documents/Arduino/libraries/Adafruit_CCS811_Library Using library RadioHead at version 1.122.1 in folder: /Users/bjw58994/Documents/Arduino/libraries/RadioHead exit status 1 Compilation error: 'GAS_CHILD_ID' was not declared in this scope
Ultimately, I don't understand how to define or pick a variable, I thought it was user defined, but this makes me think perhaps they are already defined in a library somewhere. Any help in directing me to either the correct structure/sytax of the variables or the location they are defined would be great. Thanks!
-
Nice work so far @wint0178, great that you try expanding on the examples. Sorry for the late reply.
If you look at https://github.com/mysensors/MySensorsArduinoExamples/blob/bba998bce09bc5139eb4ca7a05b0279f4083ff88/examples/PressureSensor/PressureSensor.ino#L90 you see where the existing child ids are defines. You just add another one for the gas sensor, with a unique number (incrementing by 1 is an easy way).
Try that and report back on your result. If something is unclear, just post a followup.
Suggested Topics
-
💬 24V Relay drive board
OpenHardware.io • 5 Jun 2019, 19:24 • openhardware.io 5 Jun 2019, 19:24 -
High-performance controllers
Controllers • 21 May 2018, 16:20 • Avamander 22 May 2018, 15:54 -
Using Pin Change Interrupt (PCINT) for wakeup
Development • 3 Feb 2015, 11:55 • Dirk_H 11 Apr 2015, 18:37 -
Total noob's question about building a PWM light controller
General Discussion • 3 Jul 2015, 05:03 • JoeStrout 3 Jul 2015, 17:45 -
Weather station DHT22, BMP185, SI1145
My Project • 13 Sept 2014, 14:01 • jesse 21 Sept 2016, 17:04 -
Porting MySensors to non-arduino platforms (like ARM mbed)
Hardware • 9 Oct 2016, 11:20 • nono8223 9 Oct 2016, 11:31 -
💬 MDMScreen
OpenHardware.io • 26 Dec 2017, 16:26 • openhardware.io 26 Dec 2017, 21:00 -
Arduino (Fibaro Wall plug)
Feature Requests • 22 Nov 2014, 12:49 • MarkV 22 Nov 2014, 15:08