TS7-Pro 7-inch Touch Screen
Once added, you can use the Switch widget to control the LED; the value of the photoresistor on the Text widget will
be updated every 1 minute, when the value > 100, the motor rotates clockwise for 5 seconds; if the value is less than
20, the motor rotates counterclockwise for 5 seconds. You can see the change over time in the Chart widget.
Code Explanation
def getValue():
analogVal = ADC0834.getResult()
if analogVal > 100:
move.clockwise()
sleep(5)
move.stop()
elif analogVal < 20:
move.contrarotate()
sleep(5)
move.stop()
return analogVal
Read the value of channel CH0 (with photoresistor connected) of the ADC0834. If the value is >100, the motor rotates
clockwise for 5 seconds. If the value is less than 20, the motor rotates counterclockwise for 5 seconds.
'CPU Temp': {
'type': 'numeric',
(continues on next page)
5.5. Cloud4RPi 121