Page 1 of 1

compiling error for multiple sensors

Posted: 02 Sep 2020 21:48
by cebluto
I have been trying to get multiple water sensors to run on a Z-Uno. I am new to the Z-Uno so I adapted the water level example below. One sensor works just fine and I can get both sensors to run and return data if I leave out the second ZUNO_SENSOR_MULTILEVEL. When I add this I get the following error:

exit status 2
C:\ Program Files ( x86)\Arduino\arduino-builder returned 2
Error compiling for board Z-Wave>ME Z-Uno

Can somebody give me a clue as to what I am doing wrong?


Code: Select all

// demo sketch for connecting multiple level water sensor to Z-Uno

// add library
#include "ZUNO_DHT.h"
// pin connection sensor
#define PIN_SENSOR1 A0
#define PIN_SENSOR2 A1

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_ALWAYS_AWAKW);

// set up channel
ZUNO_SETUP_CHANNELS(
    ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_GENERAL_PURPOSE_VALUE, 
                          SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE,  
                          SENSOR_MULTILEVEL_SIZE_ONE_BYTE, 
                          SENSOR_MULTILEVEL_PRECISION_ZERO_DECIMALS,
                          getterLevel1)  
    ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_GENERAL_PURPOSE_VALUE, 
                          SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE,  
                          SENSOR_MULTILEVEL_SIZE_ONE_BYTE, 
                          SENSOR_MULTILEVEL_PRECISION_ZERO_DECIMALS,
                          getterLevel2)
);

int level1;  // here we will store the data sensor
int level2;
int levelpercent1;  // here we will store the value level percent
int levelpercent2;

void setup() {
    Serial.begin();
    Serial.println("start");  
}

void loop() {
    // obtaining readings from the level water sensor1
    level1=analogRead(PIN_SENSOR1);
    Serial.print("level1 = ");
    Serial.println(level1);   
    // in percent
    levelpercent1=level1/10.24;
    Serial.print("levelpercent1 = ");
    Serial.println(levelpercent1); 
     // send data to channel
    zunoSendReport(1);     
    // send every 30 second
    delay(3000);
    // obtaining readings from the level water sensor2
    level2=analogRead(PIN_SENSOR2);
    Serial.print("level2 = ");
    Serial.println(level2);   
    // in percent
    levelpercent2=level2/10.24;
    Serial.print("levelpercent2 = ");
    Serial.println(levelpercent2); 
     // send data to channel
    zunoSendReport(1);     
    // send every 30 second
    delay(3000);
}
   
byte getterLevel1() {
    return (byte)levelpercent1;
}
byte getterLevel2() {
    return (byte)levelpercent2;
}

Re: compiling error for multiple sensors

Posted: 03 Sep 2020 00:52
by PoltoS
Missing a coma after getterLevel1)

Re: compiling error for multiple sensors

Posted: 03 Sep 2020 01:32
by cebluto
I know that was needed but that did not fix the problem

Re: compiling error for multiple sensors

Posted: 03 Sep 2020 16:11
by cebluto
I rewrote the program and it worked, so I don't really know what the problem was.
Thanks for your help