How to use two ENV units with PaHUB (UIFlow)
-
Glad the video helped ;)
-
@liemph Could you share the link to the video, please?
-
@grafolabs
I think this is the video
https://youtu.be/nMsCwqCE5c8It is clear in explaining the PaHUB with UIFlow
-
Hi Guys
I have some further question, what about M5Stick C + ENV HAT + PbHUB connect together? -
@jollawat There is no problem. The pins used for the Hat (ENV HAT) and the ones used for the grove port (PbHUB) are different.
-
@liemph I tried connect and program by UIFlow it but there are some error after run on screen said “please remove ENV hat” when we add PbHUB into list.
-
@jollawat I did not get it. Please post also your configuration (the connection between Stick-C, Hat and Unit) and your code.
-
@jollawat I do not have any ENV Hat, but I have a PIR Hat, and I tried to reconstruct your problem. I connected my PIR Hat and my PbHub (to Port A) of my Stick C. Then I connected my Light Unit to Port0 of my PbHub. Then I programmed using UiFlow to show the measurement results of both the PIR Hat and Light Unit. It worked well. Please see below, the code snapshot and list.
-
-
from m5stack import * from m5ui import * from uiflow import * import hat import unit import hat setScreenColor(0x111111) pbhub0 = unit.get(unit.PBHUB, unit.PORTA) hat_pir0 = hat.get(hat.PIR) label0 = M5TextBox(13, 8, "PIR Hat", lcd.FONT_Default,0xFFFFFF, rotate=0) label1 = M5TextBox(12, 63, "PbHUB", lcd.FONT_Default,0xFFFFFF, rotate=0) label2 = M5TextBox(34, 34, "0", lcd.FONT_Default,0xFFFFFF, rotate=0) label3 = M5TextBox(0, 83, "+Light Unit", lcd.FONT_Default,0xFFFFFF, rotate=0) label4 = M5TextBox(26, 109, "0", lcd.FONT_Default,0xFFFFFF, rotate=0) while True: label2.setText(str(hat_pir0.state)) label4.setText(str(pbhub0.analogRead(0))) wait(1) wait_ms(2)