Download presentation
Presentation is loading. Please wait.
Published byIwan Sanjaya Modified over 6 years ago
5
Getting Started from sense_hat import SenseHat sense = SenseHat()
6
Scroll a Message sense.show_message("One small step for Me!",
text_colour=[255, 0, 0]) sense.show_message("One small step for Pi!", text_colour=[255, 0, 0])
7
Is it Cold in here? temp = sense.get_temperature()
print("Temperature: %s C" % temp)
8
LEDs X = [255, 0, 0] # Red O = [255, 255, 255] # White
question_mark = [ O, O, O, X, X, O, O, O, O, O, X, O, O, X, O, O, O, O, O, O, O, X, O, O, O, O, O, O, X, O, O, O, O, O, O, X, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, X, O, O, O, O ] sense.set_pixels(question_mark)
9
Temperature Visualise! aka how hot is your breath!
from sense_hat import SenseHat sense = SenseHat() sense.clear() on_pix = [255,0,0] off_pix = [0,0,0]
10
Temperature Visualise! Aka how hot is your breath!
while True: hum = sense.humidity hum = round(hum,1) if hum > 100: hum = 100 leds = [] ratio = 64 / 100.0
11
Temperature Visualise!
on_count = int (ratio*hum) off_count = 64 - on_count leds.extend([on_pix]*on_count) leds.extend([off_pix]*off_count) sense.set_pixels(leds)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.