TS7-Pro 7-inch Touch Screen
the data type of the transferred content ('numeric' is a numeric type, 'string' is a string type, 'bool' is a
boolean type, and 'location' is a list containing two dictionaries).
Through the analysis of the variables dictionary, we can know that Cloud4RPi will read the keys of the
variables dictionary and display the value corresponding to the key in the Control Panel. Obviously we can-
not change the keys of the variables dictionary, but we can change the value in the key (the value of the 'bind'
dictionary) to let the widgets display the content we want.
For example, if we want to send humidity values to Cloud4RPi, we cannot add a new key to the variables dictio-
nary, but we can borrow a key, such as the 'Room Temp' key, and then write the function that returns the humidity
value in the corresponding 'bind' key.
variables = {
'Room Temp': {
'type': 'numeric' if ds_sensors else 'string',
'bind': ds_sensors[0] if ds_sensors else sensor_not_connected
},
'LED On': {
'type': 'bool',
'value': False,
'bind': led_control
},
'CPU Temp': {
'type': 'numeric',
'bind': rpi.cpu_temp
},
'STATUS': {
'type': 'string',
'bind': listen_for_events
},
'Location': {
'type': 'location',
'bind': get_location
}
The vdiagnostics stores information about the Raspberry Pi and is used to verify and prevent misconnections.
vdiagnostics = {
'CPU Temp': rpi.cpu_temp,
'IP Address': rpi.ip_address,
'Host': rpi.host_name,
'Operating System': rpi.os_name,
'Client Version:': cloud4rpi.__version__,
}
5.5.3 Projects
In this section, you will start learning to create IoT projects.
Before starting the project, you should have downloaded the code we provided.
Open a Terminal and enter the following command to download them from github.
git clone https://github.com/sunfounder/ts7-pro
Then copy the codes from the iot folder to the cloud4rpi-raspberrypi-python folder.
5.5. Cloud4RPi 109