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
-
Method to reveal sketch inside node or g/w
General Discussion • 19 Oct 2015, 01:36 • 5546dug 19 Oct 2015, 19:22 -
Soil Tensiometer Sensor Network
My Project • 16 Feb 2015, 19:19 • aur 17 Jun 2016, 11:35 -
MyController.org - 0.0.3-alpha1 released
MyController.org • 29 Feb 2016, 23:12 • jkandasa 6 Mar 2016, 16:56 -
💬 MySensor Dioder (Ikea)
OpenHardware.io • 5 Jun 2016, 13:07 • openhardware.io 13 Dec 2016, 16:17 -
💬 Anna2040 RP2040 Uno-shaped board
OpenHardware.io • 25 Nov 2022, 18:24 • openhardware.io 25 Nov 2022, 18:24 -
Gateway for Pachube Or Mysql Database
Feature Requests • 11 Jul 2014, 13:23 • legeantvert 29 Aug 2014, 14:24 -
💬 Arduino Based Serial Controller For Welding Machine
OpenHardware.io • 27 Aug 2021, 07:05 • openhardware.io 27 Aug 2021, 07:05 -
Dimmable LED kitchen light (Arduino, APDS-9960, RGBWW led)
OpenHardware.io • 28 Jul 2016, 16:50 • openhardware.io 10 Nov 2017, 09:24