Read current value from a pin
(pin)
| 152 | time.sleep(1) |
| 153 | |
| 154 | def read_pin_value(pin): |
| 155 | """Read current value from a pin""" |
| 156 | if GPIO_BACKEND == 'gpiozero': |
| 157 | device = pin_states.get(pin, {}).get('device') |
| 158 | if device: |
| 159 | return 1 if device.value else 0 |
| 160 | return 0 |
| 161 | elif GPIO_BACKEND == 'RPi.GPIO': |
| 162 | return GPIO.input(pin) |
| 163 | else: # mock |
| 164 | return GPIO.input(pin) |
| 165 | |
| 166 | @app.route('/') |
| 167 | def index(): |
no test coverage detected