Closed Hamlet3000 closed 5 months ago
following implementation might fix it
float getPMValues(int type) {
PmResult pm = sds.queryPm();
if (pm.isOk()) {
if (type == 25){
return pm.pm25;
} else if (type == 10) {
return pm.pm10;
}
else return 0;
}
}
need to test it properly!
Block description
compiler error: {"exit":"Command failed: 1: Uncaught Fatal Exception","process":"/tmp/6335d0de8c09de8588e1a8e4cf75cb6d/sketch/sketch.ino: In function 'void publisOSM()':\n/tmp/6335d0de8c09de8588e1a8e4cf75cb6d/sketch/sketch.ino:121:33: error: 'pm' was not declared in this scope\n addMeasurement(SENSOR_IDRID,pm.pm25);\n ^~\n/tmp/6335d0de8c09de8588e1a8e4cf75cb6d/sketch/sketch.ino:121:33: note: suggested alternative: 'Pm'\n addMeasurement(SENSOR_IDRID,pm.pm25);\n ^~\n Pm\n\nError during build: exit status 1\n"}
Expected block behaviour
if you add the SDS011 block within a funcion, pm is not declared
blockly code: PmResult pm = sds.queryPm(); should not be within the void loop()