Download
slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Getting Started PowerPoint Presentation
Download Presentation
Getting Started

Getting Started

98 Vues Download Presentation
Télécharger la présentation

Getting Started

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