! { loop {} }\nuse physical_ai_hal::*;\n\n// Two concurrent concerns, Embassy-style: a NAVIGATOR that drives to the goal,\n// and a HEARTBEAT that blinks the LED at ~2 Hz so ground control knows the\n// firmware is alive. This starter navigates but never blinks. Add the heartbeat\n// using millis() — toggle the LED every 250 ms — WITHOUT blocking the loop.\nfn control(p: &mut Peripherals) {\n // --- navigator task ---\n let dist = p.goal.distance();\n let bearing = p.goal.bearing();\n let turn = 1.0 * bearing;\n let forward = (0.8 * dist).min(0.6);\n p.motors.set(forward - turn, forward + turn);\n\n // --- heartbeat task (TODO) ---\n // let on = (millis() / 250.0) as i32 % 2 == 0;\n // p.led.set(on);\n}\ncontrol_loop!(control);\n","task":{"goal":[1.2,1.2],"requireBlink":6,"time":12.0,"tol":0.2},"title":"Async Tasks & the Real-Time Loop"}">
PYTHON · NUMPY · IN-BROWSER

Async Tasks & the Real-Time Loop

Two concurrent concerns on one non-blocking real-time loop — navigate AND blink, Embassy-style.