M5stack connect HC-SR04 with I/O port (not grove connector) coding by UI Flow
-
Hello i'm trying M5stack Basic Development conect ultrasonic sensor model HC-SR04 with GPIO2 (trig) & GPIO5 (echo) for read parameter shown on the screen.
So coding on UI Flow but in platform don't have digital pwm read input function (in Arduino IDE is "pluseIn")
Could there be any object or commands or functions that can be used instead, or how can the program read pulse input ?thank you so much.
-
@doctan I used an ultrasonic sensor with m5stack in arduino before but it is a simple one
https://www.hackster.io/lukasmaximus89/grove-ultrasonic-sensor-with-m5stack-710d15 and made a guide, but it is arduino. For uiflow since m5stack did not create any ultrasonic unit you would have to create your own code in micropython to control it and then create custom blocks. I think I read that hc-sr04 has 5 pins, is it true? and is it using i2c protocol or just analogue out? -
This worked well for me with pin 21 (trigger) and pin 22 (echo)