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

Method getData

Arduino/libraries/ST_Anything/PS_PulseCounter.cpp:144–165  ·  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

142
143 //function to get data from sensor and queue results for transfer to ST Cloud
144 void PS_PulseCounter::getData()
145 {
146 if (m_pCounter)
147 {
148 noInterrupts();
149 unsigned long tmpCounts = *m_pCounter;
150 *m_pCounter = 0;
151 interrupts();
152
153 m_nSensorValue = long(m_fCnvSlope * tmpCounts + m_fCnvOffset);
154
155 }
156 else //invalid Pin/Interrupt was requested, therefore we are in an error condition
157 {
158 m_nSensorValue = 0;
159 if (st::PollingSensor::debug) {
160 Serial.println(F("PS_PulseCounter::Invalid Pin Requested! Must be 21, 20, 19, 18 "));
161 }
162 }
163
164 Everything::sendSmartString(getName() + " " + m_nSensorValue);
165 }
166
167 void PS_PulseCounter::setPin(byte pin)
168 {

Callers

nothing calls this directly

Calls 1

printlnMethod · 0.80

Tested by

no test coverage detected