I noticed in makecode for circuit playground they offer multithreading in their block programming environment. This enables you can have two separate loop blocks each running an independent set of instructions. I know the esp32 is multithreaded, is this possible in uiflow or might this be a function added to future releases. It makes what would be complicated code really easy to manage.
Posts made by jpilarski
multithreading in uiflow
RE: IOS safari and chrome
IOS safari and chrome
I am trying uiflow on an ipad in either chrome or safari. When using chrome the file name portion is missing from the UI along with the file save button. When using safari you can name and save the file as usual but it is impossible to edit the name of a new function. It appears as though the keyboard visibility is off screen and this prevents one from typing in a function name. Even with the apple magic keyboard attached to the ipad I am unable to enter or edit a function name while using safari on ios.
pm2.5 and mqtt incomplete python code
Before I go into describing the bug I ran into I want to make a request that the pm2.5 blocks includes temperature and humidity values from the sensor. Now onto the issue:
I am using uiflow with pm2.5 and mqtt blocks. I start off with some block code for the pm2.5 that is working well but when I try to add the mqtt blocks the generated python code is incomplete and it doesn't include the mqtt python code even when there are mqtt blocks. Sometimes, depending on the sequence of when I add the mqtt blocks it will even remove previously generated python code that was and should still be there. If I then try and go back from the python tab to the blocks tab uiflow will lock up and I then need to reload the m5f file. I can get the code to work by typing it into the python editor but I can't get it working using blocks. Here is the file with the blocks and you can see the incomplete python code it generates. I am using 1.3.4 beta pm25 m5f on github
Here is the working python code that I manually typed into the python editor tab.
from m5stack import * from m5ui import * from uiflow import * import module from m5mqtt import M5mqtt import unit setScreenColor(0x222222) m5mqtt = M5mqtt('xxx, 'io.adafruit.com', 1883, 'xxx', 'xxx', 3000) pm0 = module.get(module.PM25) i = None ioTopics = None xPos = None yPos = None pmText = None pmVal = None xPos = 5 yPos = 16 def upRange(start, stop, step): while start <= stop: yield start start += abs(step) def downRange(start, stop, step): while start >= stop: yield start start -= abs(step) m5mqtt.start() pmText = ['SPM 1.0', 'SPM 2.5', 'SPM 10', 'APM 1.0', 'APM 2.5', 'APM 10', '# > 0.3 um', '# > 0.5 um', '# > 1.0 um', '# > 2.5 um', '# > 5.0 um', '# > 10.0 um'] i_end = float(len(pmText)) for i in (1 <= i_end) and upRange(1, i_end, 1) or downRange(1, i_end, 1): lcd.print(pmText[int(i - 1)], xPos, (yPos * i), 0xffffff) wait_ms(300) #ioTopics = topic_data #i_end2 = float(len(ioTopics)) #for i in (1 <= i_end2) and upRange(1, i_end2, 1) or downRange(1, i_end2, 1): # lcd.print(ioTopics[int(i - 1)], 150, (yPos * i), 0xffffff) while True: pmVal = [pm0.get_pm1_0_factory(), pm0.get_pm2_5_factory(), pm0.get_pm10_factory(), pm0.get_pm1_0_air(), pm0.get_pm2_5_air(), pm0.get_pm10_air(), pm0.get_num_above_0_3(), pm0.get_num_above_0_5(), pm0.get_num_above_1(), pm0.get_num_above_2_5(), pm0.get_num_above_5(), pm0.get_num_above_10()] i_end2 = float(len(pmText)) for i in (1 <= i_end2) and upRange(1, i_end2, 1) or downRange(1, i_end2, 1): lcd.print(pmVal[int(i - 1)], (xPos + 130), (yPos * i), 0xffffff) m5mqtt.publish(str('xxx/feeds/pm2-5.pm-1'),str(pmVal)) m5mqtt.publish(str('xxx/feeds/pm2-5.pm-2-5'),str(pmVal)) m5mqtt.publish(str('xxx/feeds/pm2-5.pm-10'),str(pmVal)) m5mqtt.publish(str('xxx/feeds/pm2-5.pm-2-5'),str(pmVal)) #pm2-5.particles-0-3 wait_ms(200)
uiflow firmware issues with stickC
I am trying to install stickC 1.2.3 uiflow firmware on stickC and I get the following error -
A fatal error occurred: Timed out waiting for packet header
I can upload code to this stickC board using arduino just fine. I also tried the 1.3.0 firmware but I get the same error. Also is the 1.3.0 beta only for m5stack.
RE: [Solved]Where to get basic (offline?) MicroPython firmware with lcd module support?
I did come across this info about on screen repl https://forum.micropython.org/viewtopic.php?t=5589
i2c = machine.I2C(scl=machine.Pin(4), sda=machine.Pin(5)) oled = ssd1306.SSD1306_I2C(128, 64, i2c) from FBConsole import FBConsole console = FBConsole(oled) os.dupterm(console)
RE: [Solved]Trouble burning MicroPython firmware
If you install uiflow firmware you have also installed micropython. You can connect to a repl shell, load libraries, and modify main.py. You can use any micropython ide and you aren't required to use uiflow. It is a good option though. I like using upycraft. Even if I am running uiflow I'll still keep a connection to the board open with upycraft to get immediate feedback. With upycraft you have direct access to the filesystem and you can drag and drop files to and from the board. You can also run
where module is one of the listed modules. To learn more of all the built in functions available.