MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / read

Method read

Software/Python/easysensors.py:335–352  ·  view source on GitHub ↗

Return values: 0 or 1 are valid values -1 may occur when there's a reading error On a reading error, a second attempt will be made before returning a -1 value

(self)

Source from the content-addressed store, hash-verified

333 raise("Digital Sensor Init")
334
335 def read(self):
336 '''
337 Return values:
338 0 or 1 are valid values
339 -1 may occur when there's a reading error
340
341 On a reading error, a second attempt will be made before
342 returning a -1 value
343 '''
344 try:
345 self.value = self.gpg.get_grove_state(self.get_pin())
346 except gopigo3.ValueError:
347 try:
348 self.value = self.gpg.get_grove_state(self.get_pin())
349 except Exception:
350 return -1
351
352 return self.value
353
354 def write(self, power):
355 self.value = power

Callers

nothing calls this directly

Calls 2

get_pinMethod · 0.80
get_grove_stateMethod · 0.45

Tested by

no test coverage detected