SunFounder Thales Kit for Raspberry Pi Pico, Release 1.0
lcd
.
clear()
What more?
We can combine thermistor and I2C LCD1602 to make a room temperature meter.
from
lcd1602
import
LCD
import
machine
import
utime
import
math
thermistor
=
machine
.
ADC(
28
)
lcd
=
LCD()
while
True
:
temperature_value
=
thermistor
.
read_u16()
Vr
=
3.3
*
float
(temperature_value)
/
65535
Rt
=
10000
*
Vr
/
(
3.3
-
Vr)
temp
=
1
/
(((math
.
log(Rt
/
10000
))
/
3950
)
+
(
1
/
(
273.15
+
25
)))
Cel
=
temp
-
273.15
#Fah = Cel * 1.8 + 32
#print ('Celsius: %.2f C
Fahrenheit: %.2f F' % (Cel, Fah))
#utime.sleep_ms(200)
string
=
" Temperature is
\n
"
+
str
(
'{:.2f}'
.
format(Cel))
+
" C"
lcd
.
message(string)
utime
.
sleep(
1
)
lcd
.
clear()
3.4. Projects
105
Summary of Contents for Thales Kit
Page 1: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 Jimmy SunFounder Jun 04 2021 ...
Page 2: ......
Page 4: ...ii ...
Page 6: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 2 CONTENTS ...
Page 140: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 136 Chapter 3 For MicroPython User ...
Page 164: ...SunFounder Thales Kit for Raspberry Pi Pico Release 1 0 160 Chapter 4 For Arduino User ...