guycarver / micropython Goto Github PK
View Code? Open in Web Editor NEWAll of my MicroPython stuff
All of my MicroPython stuff
Can you explain how you generated the font file? What has to change for different font sizes to be used in the ST7533 driver? Thanks!
Hi,
Thank you very much for the repo!
I am new to micropython and trying to play with a st7735 display on esp32c3 and set up micropython with mpremtoe enabled,
next I am trying to run some display test but failed with some errors.
Can I import the libs via mpremote? How can I do it?
My test:
Basic:
esp32-dev-micropython#cat hello.py
print("hello")
esp32-dev-micropython#mpremote run ./hello.py
hello
---
dispaly:
esp32-dev-micropython#mpremote run ./hello.py
hello
esp32-dev-micropython#cat st7735-test.py
from machine import Pin, SoftSPI, SPI
from ST7735 import TFT
import time
# 由于ftf屏的颜色有问题,因此需要重写一个函数修复一下
def TFTColor(r,g,b) :
return ((b & 0xF8) << 8) | ((g & 0xFC) << 3) | (r >> 3)
spi = SoftSPI(baudrate=1000000, polarity=1, phase=0, sck=Pin(2), mosi=Pin(3), miso=Pin(10))
tft=TFT(spi,6,10,7) #DC, Reset, CS
tft.initr()
tft.rgb(True)
tft.rotation(1) #方向调整
# 绘制背景色
tft.fill(TFTColor(0,0,0))
w = 20
h = 20
max = 160
for i in range(0,max*4-1):
x = i * 5 % max
y = i * 5 // max * h + 24
tft.fillrect((x,y),(w,h),TFTColor(255,255,255))
++i
time.sleep(0.04)
tft.fillrect((x,y),(w,h),TFTColor(0,0,0))
esp32-dev-micropython#mpremote run ./st7735-test.py
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ImportError: no module named 'ST7735'
---
st7735:
esp32-dev-micropython#mpremote run ST7735.py
Traceback (most recent call last):
File "<stdin>", line 10, in <module>
SyntaxError: invalid micropython decorator
esp32-dev-micropython#head -15 ST7735.py
#Driver for Sainsmart 1.8" tft display ST7735
#Translated by Guy Carver from the ST7735 sample code.
#Display uses SPI interface.
#todo: Use const()
import pyb
from math import sqrt
@micropython.native
def clamp( aValue, aMin, aMax ) :
return max(aMin, min(aMax, aValue))
@micropython.native
def TFTColor( aR, aG, aB ) :
---
led:
esp32-dev-micropython#cat led.py
#LED testing.
from pyb import *
dC = 5
def test( ):
l = LED(4)
for i in range(255):
l.intensity(i)
delay(dC)
for i in range(255, 0, -1):
l.intensity(i)
delay(dC)
l.off()
esp32-dev-micropython#mpremote run led.py
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ImportError: no module named 'pyb'
Dear @GuyCarver , i have tried joystick.py in my micropython (v1.9.4-7-gaeaace07 on 2018-05-13) installed ESP32 board. I have found some inconsistencies when i start getting values. You can see in attached photos below; I will be glad if you let me know about the issue, Thanks...
This is my main code;
from machine import Pin
import Joystick
import time
x_pin = 36 #ADC PIN - (VP ON BOARD)
y_pin = 39 #ADC PIN - (VN ON BOARD)
button_pin = 5 #DIGITAL PIN FOR BUTTON
j = Joystick.Joystick(x_pin, y_pin, button_pin)
while True:
j.update()
print("x:", j.x, "button:", j.button, "y:", j.y)
time.sleep(0.1)
Hello, I am wanting to use a derivative of this program that someone has made. However, that person cannot add a license as this project does not have one either! Please consider adding a license to this repository if you don't have a reason to not do so.
Hello there, while adapting your class to work on the rp2040, I found a small typo:
'accel' class has no attribute 'setfulscaleaccelrange', should be 'setfullscaleaccelrange' see
Line 380 in cb95afd
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.