Greetings everone,
hope you are doing great.
I am using standard firmata library compiled to arudino uno to read string of the values of temperature and humidity of the sensor DHT11, I am using the below code that integrated the library with standard firmata. However, this code send string to python but I do not know how to read the values in python. any support is more than appreciated.
snipppets from the arudion code:
void loop()
{
byte pin, analogPin;
/* DIGITALREAD - as fast as possible, check for changes and output them to the
* FTDI buffer using Serial.print() */
checkDigitalInputs();
/* STREAMREAD - processing incoming messagse as soon as possible, while still
* checking digital inputs. */
while (Firmata.available())
Firmata.processInput();
// TODO - ensure that Stream buffer doesn't go over 60 bytes
currentMillis = millis();
if (currentMillis - previousMillis > samplingInterval) {
previousMillis += samplingInterval;
/* ANALOGREAD - do all analogReads() at the configured sampling interval */
for (pin = 0; pin < TOTAL_PINS; pin++) {
if (IS_PIN_ANALOG(pin) && Firmata.getPinMode(pin) == PIN_MODE_ANALOG) {
analogPin = PIN_TO_ANALOG(pin);
if (analogInputsToReport & (1 << analogPin)) {
Firmata.sendAnalog(analogPin, analogRead(analogPin));
}
}
}
// report i2c data for all device with read continuous mode enabled
if (queryIndex > -1) {
for (byte i = 0; i < queryIndex + 1; i++) {
readAndReportData(query[i].addr, query[i].reg, query[i].bytes, query[i].stopTX);
}
}
}
#ifdef FIRMATA_SERIAL_FEATURE
serialFeature.update();
#endif
readDHT();
}
so this function Firmata.sendAnalog(analogPin, analogRead(analogPin)); sends the value from arudion to python, how to read the value in python?
Thanks in advance