Different btw RT_SLEEP(rt, 100) and RT_YIELD(rt)?

In example RAK_Thread.ino in library of RUI3 Arduino IDE,
I see: RT_SLEEP(rt, 100) and RT_YIELD(rt)
But i dont know what is different?

int blinkThread(struct rt *rt) {
    RT_BEGIN(rt);

    for (;;) {
        if (buttonState == HIGH) {
            digitalWrite(ledPin, HIGH);
            RT_SLEEP(rt, 200);
            digitalWrite(ledPin, LOW);
            RT_SLEEP(rt, 100);
        } else {
            digitalWrite(ledPin, LOW);
            RT_YIELD(rt);
        }
    }

    RT_END(rt);
}

int buttonThread(struct rt *rt) {
    RT_BEGIN(rt);
    for (;;) {
        buttonState = digitalRead(inputPin);
        RT_YIELD(rt);
    }
    RT_END(rt);
}
1 Like

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