This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fbconsole import FBConsole | |
scr = FBConsole(fb, TFT.BLACK, TFT.WHITE) | |
import os | |
os.dupterm(scr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tft.setvscroll(1, 1) | |
from ST7735fb import TFTfb | |
from petme128 import petme128 | |
fb = TFTfb(tft, petme128) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ST7735 import TFT | |
from machine import SPI,Pin | |
spi = SPI(2, baudrate=20000000, polarity=0, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12)) | |
tft=TFT(spi,16,17,18) | |
tft.initb2() | |
tft.rgb(True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ST7735 import TFT | |
from machine import SPI,Pin | |
import time | |
spi = SPI(2, baudrate=20000000, polarity=0, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12)) | |
tft=TFT(spi,16,17,18) | |
tft.initb2() | |
tft.rgb(True) | |
tft.setvscroll(17, 17) | |
tft.fill(TFT.BLACK) | |
tft.fillrect((0, 0), (128, 16), TFT.PURPLE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import framebuf | |
import uio | |
class FBConsole(uio.IOBase): | |
def __init__(self, fb, bgcolor=0, fgcolor=-1, width=-1, height=-1, readobj=None): | |
self.readobj = readobj | |
self.fb = fb | |
if width > 0: | |
self.width=width | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import machine | |
import struct | |
import utime | |
I2C_2 = machine.I2C(2) | |
LSM6DSL_ADDR = 106 | |
LSM6DSL_REG_CTRL1_XL = 0x10 | |
LSM6DSL_REG_CTRL2_G = 0x11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> ht = HTS221(2) | |
>>> ht.get() | |
[73.21584, 36.9939] | |
>>> ht.getTemp() | |
36.9939 | |
>>> ht.getHumi() | |
73.26691 | |
>>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> i2c = pyb.I2C(2, pyb.I2C.MASTER) | |
>>> i2c.scan() | |
[30, 41, 45, 86, 93, 95, 106] | |
>>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import pyb | |
>>> tim = pyb.Timer(1) | |
>>> tim.init(freq=10) | |
>>> tim.callback(lambda t:pyb.LED(1).toggle()) | |
>>> tim.deinit() | |
>>> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyb, time | |
while(True): | |
pyb.LED(1).on() | |
time.sleep_ms(200) | |
pyb.LED(1).off() | |
time.sleep_ms(300) |