function to get data from sensor and queue results for transfer to ST Cloud
| 82 | |
| 83 | //function to get data from sensor and queue results for transfer to ST Cloud |
| 84 | void PS_Water::getData() |
| 85 | { |
| 86 | int m_nSensorValue = analogRead(m_nAnalogInputPin); |
| 87 | |
| 88 | if (st::PollingSensor::debug) |
| 89 | { |
| 90 | Serial.print(F("PS_Water::Analog Pin value is ")); |
| 91 | Serial.print(m_nSensorValue); |
| 92 | Serial.print(F(" vs limit of ")); |
| 93 | Serial.println(m_nSensorLimit); |
| 94 | } |
| 95 | |
| 96 | //check to see if the sensor's value is < 100. If so send "dry", otherwise send "wet". Adjust the 100 as needed for your sensor. |
| 97 | Everything::sendSmartString(getName() + (m_nSensorValue<m_nSensorLimit?F(" dry"):F(" wet"))); |
| 98 | } |
| 99 | |
| 100 | void PS_Water::setPin(byte pin) |
| 101 | { |