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
Содержание TS-10
Страница 1: ...SunFounder TS 10 10 1 inch Touch Screen www sunfounder com Nov 19 2021 ...
Страница 2: ......
Страница 6: ...SunFounder TS 10 10 1 inch Touch Screen 2 CONTENTS ...
Страница 9: ...SunFounder TS 10 10 1 inch Touch Screen 5 ...
Страница 10: ...SunFounder TS 10 10 1 inch Touch Screen 6 Chapter 1 HARDWARE DESCRIPTION ...
Страница 16: ...SunFounder TS 10 10 1 inch Touch Screen 12 Chapter 2 INSTALL THE RASPBERRY PI OS ...
Страница 21: ...SunFounder TS 10 10 1 inch Touch Screen pi 3 Step 5 17 ...
Страница 53: ...SunFounder TS 10 10 1 inch Touch Screen Now you have entered OctoPrint 5 3 3D Printer Monitor 49 ...
Страница 123: ...SunFounder TS 10 10 1 inch Touch Screen Also let it appear at the right time 5 7 Scratch Projects 119 ...
Страница 130: ...SunFounder TS 10 10 1 inch Touch Screen Set the balloon to a random position 126 Chapter 5 PROJECTS AND ACTIVITIES ...
Страница 131: ...SunFounder TS 10 10 1 inch Touch Screen Let it change the color and size randomly 5 7 Scratch Projects 127 ...
Страница 141: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 137 ...
Страница 160: ...SunFounder TS 10 10 1 inch Touch Screen Copy out the second Trees 156 Chapter 5 PROJECTS AND ACTIVITIES ...
Страница 165: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 161 ...
Страница 167: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 163 ...
Страница 171: ...SunFounder TS 10 10 1 inch Touch Screen Then we add the Pen extension function 5 7 Scratch Projects 167 ...
Страница 181: ...SunFounder TS 10 10 1 inch Touch Screen 5 7 Scratch Projects 177 ...
Страница 209: ...SunFounder TS 10 10 1 inch Touch Screen 205 ...
Страница 210: ...SunFounder TS 10 10 1 inch Touch Screen 206 Chapter 7 3D PRINTED SUPPORT ...
Страница 212: ...SunFounder TS 10 10 1 inch Touch Screen 208 Chapter 8 FAQ ...