Arduino await function / asynchronous operation

Hello everyone, I am new here. I was working with raspberry pi pico with micropython but i want to use Arduino. I started a new project but i realise arduino don't have await function. How can i use things in order ? For example first servo1 rotate 180 then rfid rc 522 works then servo2 work. I am just asking how can i use things in order . I can design after this. For know i have led and servo so when led==low , servo move. How can i do this ? Thank you .This is what i try.I know i am noob. So how can i use things in order? Thank you for help.
#include<Servo.h>
Servo servo1;
int led=8;
void setup() {
servo1.attach(5);

pinMode(led, OUTPUT);
}

void loop() {
digitalWrite(led, HIGH);
delay(3000);

digitalWrite(8, LOW);
delay(3000);
if(digitalRead(led)==0);
{
servo1.write(120);
servo1.write(10);
}
}

Hello
Your sketch needs a timer funktion.
The mother of all timer functions inside the Arduino biotop is the BWOD example located inside the IDE.

to spell it out: BWOD = Blink Without Delay

you'll find countless more detailed explanations like https://arduinogetstarted.com/tutorials/arduino-led-blink-without-delay (first google hit, not a particular recommendation) online

I ill use http reuest and take data from rest api.Can i still use this method for await?

Try it.
We don“t know your current sketch.

Some millis() timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().

I tried it's not working.Arduino asyn work with millis() , Http response,Servo's and HX711

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