Is there a plan to progam the UnitV also in UIFlow?
Thank you crami25
I thought that I have to use the RELAY-Unit-Component and the PbHub.Unit-Component simultaneously in UIFlow.
But as you told me, I just have to set the Outputs on the PbHub to 0 oder 1 :-)
No need of the RELAY-Unit-Component in software.
from m5stack import * from m5ui import * from uiflow import * import unit setScreenColor(0x222222) pbhub0 = unit.get(unit.PBHUB, unit.PORTA) while True: pbhub0.digitalWrite(0, 0, 1) wait_ms(100) pbhub0.digitalWrite(1, 0, 1) wait_ms(100) pbhub0.digitalWrite(2, 0, 1) wait_ms(100) pbhub0.digitalWrite(3, 0, 1) wait_ms(100) pbhub0.digitalWrite(4, 0, 1) wait(1) pbhub0.digitalWrite(0, 0, 0) wait_ms(100) pbhub0.digitalWrite(1, 0, 0) wait_ms(100) pbhub0.digitalWrite(2, 0, 0) wait_ms(100) pbhub0.digitalWrite(3, 0, 0) wait_ms(100) pbhub0.digitalWrite(4, 0, 0) wait(1)
Great it works!
Best regards Thomas
I have played around a bit with some relay units, but I cant find a way to connect 5 units to my M5Stack unit.
I have tried:
It does not work.
Does anyone have an idea or has everyone done it?
Thanks very much
With a little "wait_ms()" its more clear what you mean :-)
from m5stack import * from m5ui import * from uiflow import * setScreenColor(0x111111) label1 = M5TextBox(05, 05, "a", lcd.FONT_Default,0xFFFFFF, rotate=0) label2 = M5TextBox(05, 20, "x", lcd.FONT_Default,0xFFFFFF, rotate=0) label0 = M5TextBox(16, 50, "A", lcd.FONT_DejaVu72,0xFFFFFF, rotate=0) for angle in range(91): label0.setRotate(angle) label1.setText('angle:' + str(angle)) wait_ms(50) for posX in range(16, 256): label0.setPosition(x=posX) label2.setText('pos-x:' + str(posX)) wait_ms(100)
I am sure it is ones more a bug :-)
You can check this, if you let the angle zero. You can see that the char disappears at pos-x = 33. And the same behavior occurs, if you have rotated the char. It is obviously one more of the uncountable bugs.
@M5Stack: Why does the M5Stack not draw a char if a small part is outside of the screen? We can display a char half way, if it is rotated, but not if it is at angle 0 degrees. That makes no sense. Maybe someone would like to program a scrolling text so that chars appears on the right and disappears on the left.
The "problem" in your example is, that the letter D is to wide to display completely on the display.
Unfortunately letters are suppressed if they have not enough space on screen.
This Example works :-)
from m5stack import * from m5ui import * from uiflow import * @timerSch.event('timer1') def ttimer1(): global curLetter if curLetter == "A": curLetter = "B" else: if curLetter == "B": curLetter = "C" else: if curLetter == "C": curLetter = "D" else: if curLetter == "D": curLetter = "A" label0.setText(curLetter) label1.setText(curLetter) pass setScreenColor(0x000000) curLetter = "A" label0 = M5TextBox(25, 20, curLetter, lcd.FONT_DejaVu72,0xFFFFFF, rotate=0) label1 = M5TextBox(25, 80, curLetter, lcd.FONT_DejaVu72,0xFFFFFF, rotate=0) timerSch.run('timer1', 500, 0x00)
@m5stickfreakler Try to set the longpress time shorter.
Thanks for reply but that wasn't the question. My code in my post works fine. :-)
But it would be great if the implemented Micropython standard solution (with events) didn't just trigger an event when I release the button.
Like my alternative code, most people want that the event is triggered immediately after the "long press time" is past, not only when the button is released.
So the Micropython event solution would be more powerful, if I could solve the "problem" in one code line instead of fifty.
I am not such good in micropython but I think there is unfortunately no simpler solution for that.
I have often a connection problem to my m5stack device.
If I upload a program to the device and something goes wrong, I cannot connect to the device again.
I have to close the Windows UIFlow and start up again and load code again.
This problem occurs very often and it is very annoying.
It seams to be a blocking of the com port by the Windows software because if I try to burn the firmware I get following message:
Command: --chip esp32 --port COM4 --baud 921600 --before default_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x10000 application_0x10000.bin 0x1000 bootloader_0x1000.bin 0x200000 fatfsImg_0x200000.img 0x8000 partitions_0x8000.bin 0xf000 phy_init_data_0xf000.bin 0x3ff000 wifi_0x3ff000.bin ===================================================  Failed to execute script esptool Traceback (most recent call last): File "esptool.py", line 2849, in <module> File "esptool.py", line 2842, in _main File "esptool.py", line 2549, in main File "esptool.py", line 213, in __init__ File "site-packages\serial\__init__.py", line 88, in serial_for_url File "site-packages\serial\serialwin32.py", line 62, in open serial.serialutil.SerialException: could not open port 'COM4': PermissionError(13, 'Access denied', None, 5) esptool.py v2.5.0
After restarting the windows UIFlow everything works fine for a while.
Does anyone have a better solution?
Is there a possibility to make https request, instead of http request?
Nowadays there is nearly no web site out there that allows http.
Everything is https. I would like to get info from an api that provides weather data.
Or is the received data simply to large? I get an error: 12 ENOMEM.
The received data is about 8k
Thanks for help :-)
It works just if I upload the program to the device, but not in RUN-mode :-(
Does anyone have a better solution?