Aruino Esp01 (esp8266) Async / Await Function

Hello everyone, I am using arduino with esp01 (esp8266) . I am taking reponse from api. Then i need to measure weight with HX 711 then i need to use servo. But i can't use await function. Millis doesn't work too so how can i use await function.Is there librarry on github or can i do with while loops like true, false. I need an advice for async work. I need to get this work with arduino. When i take resposne from api servo will go 180 then hx711 measure height if measure okay then servo will go 0. Sometimes hx711 take 1minute sometimes 30 sec so i need async work.
Any help will be appreciated. Thanks.

Where is the await() function? I've never seen this.

Why not ?
How did you try to use millis() ?

I mean i couldn't find await func on arduino.Is there a function i can use like await on arduino ?

There is no await() function. What do you expect such a function to do ?

You would probably benefit from reading Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE

I tried millis function but for example sometimes hx711 need more time . For example sometimes hx711 measure 1kg on 10 sec but sometimes hx711 measure 1kg on 30 sec so i couldn't use millis.Or did i use millis wrong? I tried like Demonstration code for several things at the same time this SeveralThingsAtTheSameTimeRev1.ino.

I want it to wait until it gets a response from the api (this could take a while because i don't know when i take resposne from api this is variable.Sometimes it could take 1 hour sometime it could take 1 minute or 10 sec.). Then i want to servo motors wait until hx711 measure right scale. I was using raspberry pi pico for that with micropython. I did this with await function but then i couldn't find library on micropython so i decided to do my project with arduino because arduino has my libraries.


Do note "millis()" is an unsigned long ("UL") - a 64 bit number. If you use only half the bits, yes it rolls over in 64.536 seconds and/ or becomes negative in 32.768 seconds.

It sounds like the HX711 functions that you are using are blocking and don't return a value until it is valid by some criteria. If that is the case then there is little that can be done in a single threaded environment

Which HX711 functions are you using ?

I am using HX711_ADC/examples at master · olkal/HX711_ADC · GitHub this library.

So that is the library, but which sketch do you have a problem with ?

I am using Read_1x_load_cell this. Sorry for late comment :frowning:

I hope not - that code would not compile. Most of it appears to be missing, not to mention not posted in "code tags" according to the forum instructions. :roll_eyes:

I need to keep try until i>200 but i don't know how can i do that.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.