Is this possible?

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
thorangutang
 
Posts: 18
Joined: Fri Jul 20, 2012 6:41 am

Is this possible?

Post by thorangutang »

Hi there been at this for a while and have yet to determine if it can be done in Circuitpython so let me try a general question.

On a Feather ESP32-S2, is it possible to listen for UDP(or other wifi comunication) receive a message and use this to step a stepper motor while listening for new commands? So the Feather needs to listen for new commands and step the stepper at the same time

In c++ one would do something like the following to receive the UDP:

Code: Select all

Udp.read();
  int size;
  if ((size = Udp.parsePacket()) > 0) {
    while (size--)
      msg.fill(Udp.read());
    if (!msg.hasError())

//then stepper code
 {
But I cannot for the life of me figure out how to do this in Circuitpython.

Can anyone point me in the right direction?

Thank you!

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Is this possible?

Post by danhalbert »

You could use asyncio (https://learn.adafruit.com/cooperative- ... th-asyncio) and check whether there is activity on an incoming socket, using a non-blocking socket. I am not sure of the best way to do that. We're working on an asyncio requests library: viewtopic.php?f=60&t=191307

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”