120 likes | 241 Views
Getting Started. from sense_hat import SenseHat sense = SenseHat (). 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]). Is it Cold in here?.
E N D
Getting Started from sense_hat import SenseHat sense = SenseHat()
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])
Is it Cold in here? temp = sense.get_temperature() print("Temperature: %s C" % temp)
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, 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)
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]
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
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)