Asynchronous REST API call + LED matrix display

Hey everyone,

I am a newbie in the Arduino world so sorry if this post sounds dumb :confused:

I am working on a personal project using an Arduino Uno + Ethernet shield and an Adafruit LED matrix panel.

I query (every x s) a REST API than runs on my local network and display the retrieved data on the LED Matrix (scrolling).

Query + JSON parsing works properly but takes some time (around 5s).

I don't want to block the display from scrolling while retrieving the data.

So ... ideally I would need two threads runnings in parallel ... which I understood was not possible since the Arduino is single-threaded.

I stumbled upon many articles/posts referencing Timer Interrupts, Protothreading, Arduino Thread libraries ... but I must admit that I am bit lost here.

Could anyone give me some insight ?

Thanks a lot !

JC

Query + JSON parsing works properly but takes some time (around 5s).

really 5 seconds - that's a lot of time... is that really that complex what you need to parse? or did you set a timeOut to 5 seconds and you wait for timeOut??

Hi J-M-L,

This is actually another issue I am facing :confused: .
The message is not complex at all and the timeout is not reached.

The 5s are spent reading the ethernet client. I suspect an issue with the way I am buffering (I use Serial.readBytes).

Thanks

Jad

Could anyone give me some insight ?

Without seeing your code? Yeah, it's too complex and slow. Hope that helps.