Skip to content

Instantly share code, notes, and snippets.

@mleyvaz
Last active December 2, 2016 20:48
Show Gist options
  • Save mleyvaz/a68f6264877a0b97c2d7a8bc92d9d44c to your computer and use it in GitHub Desktop.
Save mleyvaz/a68f6264877a0b97c2d7a8bc92d9d44c to your computer and use it in GitHub Desktop.
# Read the temperature in the -40 to 120 interval and shows in the leds
from sense_hat import SenseHat
sense = SenseHat()
red = (255, 0, 0)
blue = (0, 0, 255)
while True:
temp = sense.temp
print(temp)
temp=int(((-40-temp)/(-40-120))*60)
pixels = [red if i < temp else blue for i in range(64)]
sense.set_pixels(pixels)
@mleyvaz
Copy link
Author

mleyvaz commented Dec 2, 2016

Read the temperature in the -40 to 120 interval and shows in the led in the Raspberry Pi Sense HAT . Try it out at
https://trinket.io/library/trinkets/create?lang=python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment