@davesee I heard about setting a flag on movement detected, written at the C level. Hoping to avoid that level of coding. Will forward your link to my (volunteer) team who do C coding if they can confirm your design.
Posts made by jhfoo
-
RE: Wake up on pick-up
-
RE: Unable to find documentation for Python in UIFlow
@thrasher I especially like the reference to his github repo for compatible libraries to be used on generic upython firmware: https://github.com/lukasmaximus89/M5Stick-C-Micropython-1.12
-
RE: UIFlow 1.5.3
@m5stack By GA I mean Generally Available. As in out of beta, ready for production use.
-
RE: Creating an infinite async loop
@m5stack I will share pseudo-codes of the current implementation, which is stable so far:
CycleTimer = Timer(-1) def main(): # init and connect mqtt client doCycle() def doCycle(): global CycleTimer # send stuff from mqtt # NOTE: do not use machine.lightsleep() as publish() is NOT synchronous # lightsleep() will block data from being sent CycleTimer.init(period=5000, mode=Timer.ONE_SHOT, callback=doCycle)
NOTE: this is power-intensive; calling lightsleep() will cause uiflow's mqtt client to crash quickly.
-
RE: Creating an infinite async loop
Am trying using ONE_SHOT timers. Not sure if this is the recommended approach.
-
Creating an infinite async loop
Looking to write code that will send data via mqtt perpetually. Learn recently that the publish() method is NOT synchronous, which I augmented by listening to a topic for an ack message before calling the iteration done, and the next iteration publish begins.
So I tried to close the loop by calling the publish() method within the subscribe() handler, and the app crashed with message 'RuntimeError: maximum recursion depth exceeded'.
How do people get around this?
-
RE: M5stick C - Rasp Pi integration with MQTT
@nirvana07 I would suggest you:
- First learn about writing normal Python code to learn, test, and validate your MQTT server setup.
- Use uiflow blockly to draw out your MQTT code, and flip to the Python tab to see the auto generated code. Make changes as needed.
No free lunch here. As newbie you should be prepared to invest time into this.
-
Wake up on pick-up
Is there any way to program StickC to wake up when it moved eg. picked up? Maybe some behavior from the IMU waking up deep sleep? I'm open for anything.
-
RE: I think my StickC has died ... any suggestions?
When you connect to the PC does it detect a device? Hopefully it's just the screen that blew.
-
Is m5mqtt.publish async?
I put my M5StickC to sleep after .publish() and data was never received on the server. Is there a way to confirm data receipt, maybe through a callback or some other indicator?
-
RE: UIFlow 1.5.2
@ajb2k3 Take care boss. Slow down and enjoy the earl grey.
Also: don't.do.anything.stupid. :D
-
RE: What does m5base.app_start() do?
@robalstona Yes I get that. But WHY? As I mentioned earlier, this makes testing code uploads a pain.
-
Connect to Alexa
Any idea if/ how one can connect to Alexa/ Google Assistant using the mic and speaker on M5StickC?
-
RE: Using the M5Stick-C as a controller
@rapgo Your requirement is vague: what exactly are you trying to control?
-
RE: Running code with ampy or rshell or REPL?
@ajb2k3 Adding to this: I'm using the pymakr extension to VS Code. It handles selective code upload (only changed ones).
Note that pymakr does not handle binary file transfer eg. jpg.
-
RE: isPressed? wasPressed? What's the difference?
@dclaar isPressed() reflects current state of the button (is it pressed?), and returns a Boolean. wasPressed() is an event trigger you use to execute code when the button is pressed.
Sample code below (generated from uiflow) to illustrate.
from m5stack import * from m5ui import * from uiflow import * lcd.setRotation(1) setScreenColor(0x111111) isExit = None def buttonB_wasPressed(): global isExit isExit = True pass btnB.wasPressed(buttonB_wasPressed) setScreenColor(0x000000) axp.setLcdBrightness(40) isExit = False while isExit == False: lcd.print((btnA.isPressed()), 3, 0, 0xffffff)
-
RE: Bluetooth support
@hanphony how much do you really need? uiflow as i understand it is a layer on top of micropython, simplifying the hardware choices in the product. i tried to use stock (Lobo) firmware and just getting the LCD to work was a bloody pain.
Also checked the space consumed with os.statvfs(): there's plenty of write space for some decent code.
That said, will be nice to have official BLE support.
-
RE: "Smart" network configuration from UIFlow?
@devilstower have you tried using the scan method described here?
https://docs.micropython.org/en/latest/library/network.html