What you will do:
Take a pressure reading using the weather sensor, and show it on the display segments.
What you will learn:
How to take a pressure reading, how to create a variable, how to display a variable on the segments.
Setting up the variable
This is exactly like we did in the previous card, only we need to take the pressure reading from the weather sensor instead of the temperature.
import rainbowhat
pressure = rainbowhat.weather.pressure()
Display the reading
In the same way we put the temperature reading into the buffer and then showed it, we do it with the pressure reading.
rainbowhat.display.print_float(pressure)
rainbowhat.display.show()
Run the code
As before, run your code and look for a reading on the display. Normal air pressure is around 1000 hPa, but it depends on the weather. Find out more here.
Next steps
- Can you combine the temperature and pressure readings to display one after the other?
- Can you display the following, in order?
-
the word "temp"
-
the actual temperature
-
the word "pres"
-
the actual pressure