1 / 12

Getting Started

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?.

mykelti
Télécharger la présentation

Getting Started

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Getting Started from sense_hat import SenseHat sense = SenseHat()

  2. 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])

  3. Is it Cold in here? temp = sense.get_temperature() print("Temperature: %s C" % temp)

  4. 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)

  5. 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]

  6. 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

  7. 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)

More Related