Loading the figure…
Stopped · Your code isn't running yet. Until you press Run, the board runs the program already on it.
Nothing printed yet. Press Run.
Not checked yet
Run your code to check it. The checks replay a fixed script on a virtual clock, so the same code always gets the same result.
Each fault really happens in the simulation. Trigger one, watch the figure, then read why.
Play the world: press, slide and turn the parts while the code runs.
Change a value here or click a chip in the code.
Hard and flat at the front: a clean echo.
The HC-SR04 sends a burst of ultrasound and times the echo. Sound travels about 1 cm every 29 µs, so the round trip in microseconds ÷ 58 gives centimetres.
| Pin | Connects to | What it does |
|---|---|---|
5V | VCC | Powers the sensor (15 mA). |
GND1 | GND | Ground. |
D9 | TRIG | A 10 µs HIGH pulse starts a ping. |
D10 | ECHO | Stays HIGH as long as the sound is in flight. |
Sensors and actuators this board drives, with the real connections.
Brown to GND, red to 5V, orange to a pin (D9). Servo.attach(9) then write(0..180).
| Part pin | Board pin |
|---|---|
| GND | GNDWire colour brown |
| VCC | 5VWire colour red |
| SIG | D9Wire colour orange |
A moving servo can draw 250 mA and a stalled one 700 mA. More than one servo needs its own 5 V supply, with the grounds joined.
VCC to 5V, GND to GND, TRIG to D9, ECHO to D10. A 10 µs pulse on TRIG starts a ping; ECHO's pulse length is the round trip.
| Part pin | Board pin |
|---|---|
| VCC | 5VWire colour red |
| TRIG | D9Wire colour yellow |
| ECHO | D10Wire colour green |
| GND | GNDWire colour black |