Hi all, a bit of a noob question
I have a M5Stick CPlus 1.1 and am trying to get a PIR working (not a HAT) using M5Flow
The python generated by blockly is
from m5stack import *
from m5ui import *
from uiflow import *
from easyIO import *
setScreenColor(0x111111)
PIR = None
label1 = M5TextBox(47, 106, "label1", lcd.FONT_DejaVu18, 0xFFFFFF, rotate=0)
cIntruder = M5Circle(98, 208, 20, 0x1842b7, 0x8d1762)
while True:
PIR = digitalRead(0x1A)
if PIR == 1:
cIntruder.setBgColor(0xff0000)
else:
cIntruder.setBgColor(0x33ff33)
label1.setText(str(PIR))
wait_ms(2)
I have used EasyIO to address GPIO26. I am assuming that EasyIO abstracts the complexity /definition of the GPIO to be a digital pin and that digitalRead will return 1 for HIGH and 0 for LOW. I have made the code a little inefficient by storing the value of the pin in a variable so that I can capture a value and output it to a label.
When run, the value of PIR is always 0, but the else portion of the IF statement does not appear to be executed as the colour of the circle does not change to green (0x33ff33).
The PIR component works. I have tested it on a arduino. When attached to the M5Stick, the PIR is getting 5v(tested on multimeter).
My questions are around the mapping of pins in M5Flow. Have I got it right that I use 26 to access GPIO26. I ask because when I looked at the PIN blade in M5Flow, the argument for the block is a dropdown with possible values 0-4, but EasyIO allows any value.
I can't find any decent documentation about EasyIO, the "docs" option on he M5Flow page is not very detailed.
Any help would be appreciated
Tony