# Display a mini image on the sense Sense Hat. # # See GitHub: https://github.com/mchobby/esp8266-upy/tree/master/hat-sense # # Author: Meurisse D. for Shop.mchobby.be # from machine import I2C from sensehat import SenseHat import time # PYBStick, Hat-Face: Sda=S3, Scl=S5 # Pyboard, Sda=X10, Scl=X9 i2c = I2C(1) # Raspberry-Pi Pico, Sda=GP8, Scl=GP9 # i2c = I2C( 0 ) hat = SenseHat(i2c) # See the FrameBuffer doc @ https://docs.micropython.org/en/latest/library/framebuf.html w = hat.color(150, 150, 150) b = hat.color(0, 0, 255) e = hat.color(0, 0, 0) image = [ e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, w, w, w, e, e, w, w, w, w, w, b, e, e, w, w, b, w, w, w, e, e, w, w, w, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e, e ] hat.clear() hat.pixels(image) hat.update()
# Test scroll a text message on the Sense Hat. # # See GitHub: https://github.com/mchobby/esp8266-upy/tree/master/hat-sense # # Author: Meurisse D. for Shop.mchobby.be # from machine import I2C from sensehat import SenseHat import time # PYBStick, Hat-Face: Sda=S3, Scl=S5 # Pyboard, Sda=X10, Scl=X9 # i2c = I2C( 1 ) # Raspberry-Pi Pico, Sda=GP8, Scl=GP9 i2c = I2C( 0 ) hat = SenseHat( i2c ) # See the FrameBuffer doc @ https://docs.micropython.org/en/latest/library/framebuf.html # hat.clear() hat.scroll( "Sense-Hat running under MicroPython!" )
# Test the basic drawing function on the Sense Hat. # As the sense-hat inherits from FramBuffer so all drawing functions and code # around FrameBuffer can be used on the sense hat. # # See GitHub: https://github.com/mchobby/esp8266-upy/tree/master/hat-sense # # Author: Meurisse D. for Shop.mchobby.be # from machine import I2C from sensehat import SenseHat import time # PYBStick, Hat-Face: Sda=S3, Scl=S5 i2c = I2C(1) hat = SenseHat(i2c) # See the FrameBuffer doc @ https://docs.micropython.org/en/latest/library/framebuf.html # hat.fill(hat.color(255, 0, 0)) # Red hat.update() time.sleep(1) hat.fill(hat.color(0, 255, 0)) # Green hat.update() time.sleep(1) hat.fill(hat.color(0, 0, 255)) # Blue hat.update() time.sleep(1) # Draw nested rectangle
# Test the basic character drawing on the Sense Hat. # As the sense-hat inherits from FramBuffer so all drawing functions and code # around FrameBuffer can be used on the sense hat. # # See GitHub: https://github.com/mchobby/esp8266-upy/tree/master/hat-sense # # Author: Meurisse D. for Shop.mchobby.be # from machine import I2C from sensehat import SenseHat import time # PYBStick, Hat-Face: Sda=S3, Scl=S5 i2c = I2C(1) hat = SenseHat(i2c) # See the FrameBuffer doc @ https://docs.micropython.org/en/latest/library/framebuf.html # hat.clear() # Display one charaters at the time for ch in "ABCDEFGHIJKLMNOPQRSTabcdefghijklmnopqrstuvwxyz": hat.clear() # The matrix is so small that only one char can be displayed at the time hat.text(ch, 0, 0, hat.color(125, 125, 125)) hat.update() time.sleep(1)
from flask import Flask from sensehat import SenseHat # sense hat activeren sense = SenseHat() # init flask server app = Flask(_name_) sense_val = {'val': '#000000', 'type': 'hex'} @app.route('/') def index(): return 'Greetings earthlings lockdown ga nog gelijk vree lang duren!' @app.route('/pi') def pi(): return 'dit is de pi van Arne stop met slechte code te runnen via mij!'
# See GitHub: https://github.com/mchobby/esp8266-upy/tree/master/hat-sense # # Author: Meurisse D. for Shop.mchobby.be # from machine import I2C from sensehat import SenseHat from icons import * import time from random import randint # PYBStick, Hat-Face: Sda=S3, Scl=S5 # Pyboard, Sda=X10, Scl=X9 # i2c = I2C( 1 ) # Raspberry-Pi Pico, Sda=GP8, Scl=GP9 i2c = I2C(0) hat = SenseHat(i2c) # See the FrameBuffer doc @ https://docs.micropython.org/en/latest/library/framebuf.html # Show a pulsing heart red = hat.color(200, 0, 0) for i in range(10): hat.clear() hat.icon(HEART, color=red) hat.update() time.sleep(1) hat.clear() hat.icon(HEART_SMALL, color=red) hat.update() time.sleep(1)