MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / getData

Method getData

Arduino/libraries/ST_Anything/PS_Water.cpp:84–98  ·  view source on GitHub ↗

function to get data from sensor and queue results for transfer to ST Cloud

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 2

printMethod · 0.80
printlnMethod · 0.80

Tested by

no test coverage detected