SunFounder TS-10 10.1-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
/
10.1
-
touch
-
screen
Then copy the codes from the
iot
folder to the
cloud4rpi-raspberrypi-python
folder.
84
Chapter 5. PROJECTS AND ACTIVITIES
Summary of Contents for TS-10
Page 1: ...SunFounder TS 10 10 1 inch Touch Screen www sunfounder com Nov 19 2021 ...
Page 2: ......
Page 6: ...SunFounder TS 10 10 1 inch Touch Screen 2 CONTENTS ...
Page 9: ...SunFounder TS 10 10 1 inch Touch Screen 5 ...
Page 10: ...SunFounder TS 10 10 1 inch Touch Screen 6 Chapter 1 HARDWARE DESCRIPTION ...
Page 16: ...SunFounder TS 10 10 1 inch Touch Screen 12 Chapter 2 INSTALL THE RASPBERRY PI OS ...
Page 21: ...SunFounder TS 10 10 1 inch Touch Screen pi 3 Step 5 17 ...
Page 141: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 137 ...
Page 165: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 161 ...
Page 167: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 163 ...
Page 181: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 177 ...
Page 209: ...SunFounder TS 10 10 1 inch Touch Screen 205 ...
Page 210: ...SunFounder TS 10 10 1 inch Touch Screen 206 Chapter 7 3D PRINTED SUPPORT ...
Page 212: ...SunFounder TS 10 10 1 inch Touch Screen 208 Chapter 8 FAQ ...