Thank you, @IAMLIUBO
I have confirmed that it works fine with MicroPython generated from Blynk Blockly.
Latest posts made by inasawa
-
RE: Blynk in UIFlow
-
RE: M1 mac support?
No driver needs to be installed on the M1 Mac. M5Stack Core2 connected to M1Macmini will look like this without a driver: I was able to burn UIFlow with M5Burner by specifying the device.
% ls /dev/cu.usbserial-* /dev/cu.usbserial-XXXXXXXX
-
RE: UIFlow doesn't start on new Core2
After struggling for a while, I had this Core2 replaced at the shop where I bought it as an initial defect.
I'm not sure, but it seems that the display mechanism in Arduino and the display mechanism in UIFlow are different, and even if Factory Test works normally, it may not work properly in UIFlow. -
RE: UIFlow doesn't start on new Core2
It seems that it was a short-lived joy. Revert to a black screen, distorted screen, or an upside-down screen.
I tried v1.7.1.1, v1.7.1, v1.7.0, v1.6.6 and they are all the same and have a black screen.
It's HW problem?Also, even in this situation with UIFlow is running, if I burn factory test firmware, it will work normally.
-
RE: UIFlow doesn't start on new Core2
I don't know what happened. Core2 that has not been displayed with UIFlow for 2 days since I bought it, suddenly, yes suddenly, when I reset Core2, something was displayed, and every time I reset it, the display was distorted or displayed upside down. After several resets, the display is now showing normally.
I feel that there is an unstable part in the display-related HW. Firmware is UIFlow_Core2-v1.7.1.1-core2.bin.
-
RE: UIFlow doesn't start on new Core2
Since UIFlow display nothing on the screen, I tried the test with the ILI9341 library for MicroPython I found.
https://github.com/tuupola/micropython-ili934x/blob/master/ili934x.pyI copied the above library to Core2 and ran the following code from the serial console.
import ili934x from machine import Pin, SPI spi = SPI(miso=Pin(38), mosi=Pin(23, Pin.OUT), sck=Pin(18, Pin.OUT)) display = ili934x.ILI9341(spi, cs=Pin(5), dc=Pin(15), rst=Pin(4)) display.fill(ili934x.color565(0xff, 0x11, 0x22)) display.pixel(120, 160, 0) display.print('1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ') : : : display.print('1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ')
As a result, the characters are displayed as shown in the image below.
I'm not sure what this means, but can it help analyze the problem? -
RE: UIFlow doesn't start on new Core2
It seems to be the same situation as the Core 2 I bought yesterday.
Core2FactoryTest and draw_by_touch work fine, but UIFlow_Core2 v1.7.1.1-core2 (I also tried v1.7.0 / v1.7.1) doesn't work.However, it seems running with black screen. I tried connect to Core2 from UIFlow Cloud and run the program. print() can print text to the serial console, but M5Label will show nothing on the Core2 screen. just black screen.
I tried burn with low baudrate (115200), but nothing changed
-
RE: Blynk in UIFlow
I think this BLE Blynk library is similar to the one used in UIFlow.
https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/hardware/PyCom_BLE.pyThere was a problem with a continuous call to blynk.virtual_write. blynk.virtual_write calls _write in class BlynkBLE, _write concatenates the data and sends the data when run() is called. The following code is part of class BlynkBLE.
def _write(self, data): self.bout += data def run(self): self.process() while len(self.bout): data = self.bout[:20] self.bout = self.bout[20:] print('<', data) self.tx.value(data)
If you call multiple blynk.virtual_write() in a row as follows, data1 and data2 will be concatenated, and when run() is called, the concatenated data will be sent.
blynk.virtual_write(1, data1) blynk.virtual_write(2, data2)
In this case, the iOS Blynk app was unable to get the second data. Therefore, I added the call "blynk._blynk.run()" immediately after blynk.virtual_write as shown below.
blynk.virtual_write(1, data1) blynk._blynk.run() blynk.virtual_write(2, data2) blynk._blynk.run()
-
RE: Blynk in UIFlow
In UIFlow 1.7.1/1.7.2, there seems to be an inconsistency between Blockly (generated Python code) and the Blynk library. The following is the created Blockly code.
And the following is the generated Python code for M5Stack Core2.
from m5stack import * from m5stack_ui import * from uiflow import * from ble import blynk screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0xFFFFFF) vr = None count = None vw = None value = None def blynk_write(): global vr, count, vw, value print('connected') pass def blynk_write(): global vr, count, vw, value print('disconnected') pass def blynk_write(*args): global vr, count, vw, value vr = args[0] count = count + 1 print([vr, count]) blynk.virtual_write(int(vr), count) pass def blynk_write(*args): global vr, count, vw, value vw, value = args[0], args[1] print([vw, value]) pass blynk.init('Blynk Test', '...token...', blynk.BLE) blynk.handle_event(blynk_write, 'connected') blynk.handle_event(blynk_write, 'disconnected') blynk.handle_event(blynk_write, 'write v*') blynk.handle_event(blynk_write, 'read v*') count = 0
I have modified as follows.
- make the event function name unique
- change the order of the arguments in blynk.handle_event
Then, it's works.
from m5stack import * from m5stack_ui import * from uiflow import * from ble import blynk screen = M5Screen() screen.clean_screen() screen.set_screen_bg_color(0xFFFFFF) vr = None count = None vw = None value = None def blynk_connected(): global vr, count, vw, value print('connected') pass def blynk_disconnected(): global vr, count, vw, value print('disconnected') pass def blynk_read(*args): global vr, count, vw, value vr = args[0] count = count + 1 print([vr, count]) blynk.virtual_write(int(vr), count) pass def blynk_write(*args): global vr, count, vw, value vw, value = args[0], args[1] print([vw, value]) pass blynk.init('Blynk Test', 'wbZdMJ8V1QCuYdePAqrlmt4iizSAX1j7', blynk.BLE) blynk.blynkBLE.ble.config(gap_name='Blynk Test') blynk.handle_event('connected', blynk_connected) blynk.handle_event('disconnected', blynk_disconnected) blynk.handle_event('write v*', blynk_write) blynk.handle_event('read v*', blynk_read) count = 0
-
RE: Bluetooth over Core2
Official MicroPython examples may help you.
https://github.com/micropython/micropython/blob/master/examples/bluetooth/ble_temperature_central.py
Need to change a littlefrom ble_advertising import decode_services, decode_name
->from ble.ble_advertising import decode_services, decode_name
and if you run from UIFlow,
__name__
is not"__main__"
but"flow.m5cloud"
removeif __name__ == "__main__":
and just calldemo()
if event == _IRQ_SCAN_RESULT:
is where receive advertisement dataAnother thing to note is the current UIFlow (v1.7.1) MicroPython cannot perform active scan. On some devices, the advertisement data does not contain the required data (name, etc.) but is included in the scan data which require active scan.