[Solved]M5stack core not recognizing Button Unit correctly
-
I was using the button unit (Port B) and it doesn't do anything. A press of the "A BUTTON" is recognized instead of the button unit.
I tried the same code in my m5stack gray and worked. Both are at v1.2.2from m5stack import *
from m5ui import *
import unitsclear_bg(0x222222)
btn0 = units.get(units.button,units.PORTB)
a = 1title1 = M5Title(title="Title", fgcolor=0xFFFFFF, bgcolor=0x0000FF)
def btn0_pressed():
global a
a = a +1
title1 = M5Title(title=str(a), fgcolor=0xFFFFFF, bgcolor=0x0000FF)
passwhile True:
btn0.wasPressed(callback=btn0_pressed) -
Ok, this is a problem with the m5stack core (black). I tried in two different ones, and they had the same problem. Then I tried in two greys and they did not have the problem. Please fix this.
-
The black doesn't have a port B which is the issue, on the black you need to use the A0 pin on the base.
The black only has the red port which doesn't work. -
But it still recognizes the ButtonA as a unit press :| Also, can't I use the bottom with the Port B & C ?
-
@lastcaress The Button unit is not the same as button A, B and, C
You have the go base?
Then yes it works on Port B however Units seem to be unselectable at the moment. -
@LastCaress Buttons A, B and, C use the event button loop and obtain button (Yellow blocks)
Button units use a lightgreen block.(just using blocky for example)
-
Black works with port B:
-
When coding in grey : Wait for press of UNIT button, works, no problem
When coding in black : Wait for press of UNIT button, doesn't work. If press button A, it thinks it was a press by UNIT button -
Reading pin 36 on the black cores is not possible right now. Please fix, thank you.
-
Hello @LastCaress
The hardware file if BLACK is same as GRAY expect that GRAY OWNS mpu9250.
So if the BUTTON Unit works weith GRAY, it wil also work with BLACK.
You can check the G36 on BLACK by reading the level of G36 after G36 attached to 3.3V pin. -
Simple test, 4 units, two grey, two black, using the same portB and button add on:
and it is working now. Did you update the flow?
-
@LastCaress Maybe it has been updated. UIFlow is updated everyday.