OPENMV4 uasyncio Support

Discussion related to "under the hood" OpenMV topics.
skylin008
Posts: 65
Joined: Mon Mar 13, 2017 10:18 pm

OPENMV4 uasyncio Support

Postby skylin008 » Mon Feb 24, 2020 11:02 pm

Hi, I had OPENMV4 board,need uasyncio support. The openmv4 firmware implies it is unable to run official uasyncio. The file core.py in uasyncio uses ucollections.dequeue, and this is provided by the file py/modcollections.c in the source tree. Please help me,Kindly Thanks!
User avatar
iabdalkader
Posts: 1193
Joined: Sun May 24, 2015 3:53 pm

Re: OPENMV4 uasyncio Support

Postby iabdalkader » Tue Feb 25, 2020 9:43 am

skylin008 wrote:
Mon Feb 24, 2020 11:02 pm
Hi, I had OPENMV4 board,need uasyncio support. The openmv4 firmware implies it is unable to run official uasyncio. The file core.py in uasyncio uses ucollections.dequeue, and this is provided by the file py/modcollections.c in the source tree. Please help me,Kindly Thanks!
The deque is enabled now.
skylin008
Posts: 65
Joined: Mon Mar 13, 2017 10:18 pm

Re: OPENMV4 uasyncio Support

Postby skylin008 » Thu Feb 27, 2020 10:03 pm

hi @iabdalkader, I had update the openmv4 firmware,the version is 3.6, the detail is : MicroPython v1.12-omv OpenMV v3.6.0 2020-02-07; OPENMV4-STM32H743. But when I used the uasyncio,the error as show: AttributeError: 'module' object has no attribute 'deque'.Does version 3.6 had include the deque? Thanks !
The code as follow:

Code: Select all

import uasyncio as asyncio
from pyb import UART
uart = UART(3, 9600)


async def sender():
    swriter = asyncio.StreamWriter(uart, {})
    while True:
        await swriter.awrite('Hello uart\n')
        await asyncio.sleep(2)

async def receiver():
    sreader = asyncio.StreamReader(uart)
    while True:
        res = await sreader.readline()
        print('Recieved', res)

loop = asyncio.get_event_loop()
loop.create_task(sender())
loop.create_task(receiver())
loop.run_forever()
User avatar
iabdalkader
Posts: 1193
Joined: Sun May 24, 2015 3:53 pm

Re: OPENMV4 uasyncio Support

Postby iabdalkader » Fri Mar 06, 2020 6:24 am

Hi, sorry for the delay I thought I replied to this... The deque is enabled if you build from source, otherwise it will be available in the next release.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 24 guests