Page 1 of 1

Modified EspEasySlave to read digital values and store the needed pin number, then return it as analog read

Posted: 21 Aug 2017, 20:22
by quasar66
I needed to read 6 sensors very fast (at least a couple of times per second). Each sensor returns 0 if a device is in front of it. I need that data exposed at ~1/s to mqtt.

Having worked with the EspEasy library I modified the EspEasySlaves library to make an Arduino Uno Slave that:
- on start, the location is set to 0
- reads 6 sensors very fast (~10 times per second) - D2 to D7
- saves in memory the first sensor that has value 0 (for pin D2 saves 1, for pin D7 saves 6)
- when pin A4 or A5 is read by EspEasy via I2C, it returns the stored location as a fake analog read

https://github.com/yahat/ESPEasySlaves_ ... igitalPins

When I have time I'll try to make it a full plugin.