Bad, works when plugged to computer
but DOESN'T WORK when standalone :(
Posts made by stjofr
-
RE: MPU6886 (Accelerometer) with Atom S3 in MicroPython (mpu6886.py)
-
RE: MPU6886 (Accelerometer) with Atom S3 in MicroPython (mpu6886.py)
No need :)
Imu.getAccel()
I have it :)
-
MPU6886 (Accelerometer) with Atom S3 in MicroPython (mpu6886.py)
Hello
I use this code :i2c = SoftI2C(scl=Pin(39), sda=Pin(38)) sensor = MPU6886(i2c) ax, ay, az = sensor.acceleration
It's OK when connected to PC with USB in Thonny
But there is an error when the M5AstomS3 is connected to a simple charger !Is there a correct mpu6886.py to use with AtomS3 ?
-
Generating QRCode in MicroPython [GUIDE]
Try this code !
import M5 M5.Display.clear() M5.Display.drawQR(x=0, y=0, w=128, text="https://www.m5stack.com")
And you have this :
-
RE: Battery follow up in UI Flow2
This code will help :
print(M5.Power.getBatteryLevel())
-
M5 MicroPython Library documentation
Hello
Python is cool, so in the interface you can type :
import M5 help(M5)
So you have a list of all M5 Library Content, such as :
help(M5.Display) # I find the fillCircle function :) M5.Display.fillCircle(20, 20, 10, 0xFF0000) # And I draw a red ball :)
But I had to guess the arguments of the fillCircle function :(
Is there a way to have a complete documentation of the libraries ? Cause we have not the full prototype :
help(M5.Display.fillCircle) # object <bound_method> is of type bound_method
-
RE: wasDoubleclicked_event WITHOUT wasClicked_event
[SOLVED]
Here is my solution, using ONLY wasPressed and wasReleased events :)
from time import ticks_ms ms_down = 0; ms_up = 0; ms_last_up = ticks_ms() click_timer = Timer(0) def btnA_wasPressed_event(state): global ms_down ms_down = ticks_ms() click_timer.init(period=250, mode=Timer.ONE_SHOT, callback=btnA_longclick) def btnA_wasReleased_event(state): global ms_up, ms_last_up click_timer.deinit() ms_up = ticks_ms(); click_length = ms_up - ms_down click_delay = ms_up - ms_last_up; ms_last_up = ms_up if (click_delay < 250): ms_last_up = 0 btnA_doubleclick() elif (click_length < 250): click_timer.init(period=250, mode=Timer.ONE_SHOT, callback=btnA_simpleclick)
With the functions here :
def btnA_simpleclick(timer): pass def btnA_doubleclick(): pass def btnA_longclick(timer): click_timer.init(period=250, mode=Timer.ONE_SHOT, callback=btnA_longclick) pass
-
RE: microPython on esp32 C3 mate error InvalidPin when use GP19 for relay.
Why don't you use the 1st argument (pin number) in integer format ?
-
wasDoubleclicked_event WITHOUT wasClicked_event
Hello
I use MicroPython on M5StickCPlus or M5AtomS3.
The goal to use the callbacks to manage Clicks and DoubleClicks :
BtnA.setCallback(type=BtnA.CB_TYPE.WAS_CLICKED, cb=btnA_wasClicked_event)
BtnA.setCallback(type=BtnA.CB_TYPE.WAS_DOUBLECLICKED, cb=btnA_wasDoubleclicked_event)I want the DoubleClick event to be triggerer WITHOUT the Clicked event to be fired (even twice !)
It makes this :
Simple Click : btnA_wasClicked_event
Double Click : btnA_wasClicked_event, btnA_wasClicked_event, btnA_wasDoubleclicked_eventBad :(
I used before managing DoubleClick myself with microtimes... but do not want anymore :)