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.
Measure distance with an ultrasonic sensor: gpiozero's DistanceSensor times the echo, and an LED comes on when something gets too close.
| Pin | Connects to | What it does |
|---|---|---|
GPIO23 | HC-SR04 TRIG | Trigger pulse output |
GPIO24 | HC-SR04 ECHO through the divider | Echo input |
5V | HC-SR04 VCC | Sensor supply |
GND | HC-SR04 GND, divider and LED | Return |
GPIO17 | 330 Ω resistor and LED | Warning output |
Sensors and actuators this board drives, with the real connections.
Anode (long leg) to GPIO17 on pin 11 through a 330 Ω resistor, cathode to GND on pin 9: about 4 mA from 3.3 V. gpiozero calls it LED(17).
| Part pin | Board pin |
|---|---|
| A | GPIO17Wire colour orange |
| K | GNDWire colour black |
Never connect an LED without its resistor: the pin would try to source far more than 16 mA.
VCC to 5V on pin 2, GND to pin 6, TRIG to GPIO23 on pin 16 (3.3 V is enough to trigger it), ECHO to GPIO24 on pin 18 through a divider: 1 kΩ in series, 2 kΩ to GND.
| Part pin | Board pin |
|---|---|
| VCC | 5VWire colour red |
| TRIG | GPIO23Wire colour yellow |
| ECHO | GPIO24Wire colour green |
| GND | GNDWire colour black |
ECHO is a 5 V output. Straight into a GPIO pin it pushes current through the pad's protection diode into the 3.3 V rail and can kill the pin or the whole I/O chip.