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 scopeUltimately, 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!
-
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 scopeUltimately, 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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login