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.
Read a potentiometer on A1 with the R4's 14-bit ADC and set an LED's brightness with PWM on ~9. Pick the resolution and see the same voltage as 0-1023 or as 0-16383.
| Pin | Connects to | What it does |
|---|---|---|
A1 | The potentiometer's middle leg (wiper) | Analog input, 0-5 V. |
D9 | 1 kΩ resistor, then the LED | PWM output at 490 Hz. |
5V | One end of the potentiometer | The top of the divider. |
GND | The other end, and the LED's short leg | The bottom of the divider. |
Sensors and actuators this board drives, with the real connections.
Ends to GND and 5V, the middle leg (wiper) to A1. analogRead(A1) goes from 0 to 1023 by default, or to 16383 after analogReadResolution(14).
| Part pin | Board pin |
|---|---|
| 1 | GNDWire colour black |
| 2 | A1Wire colour blue |
| 3 | 5VWire colour red |
Brown to GND, red to 5V, orange to D9. Servo.attach(9), then write(0..180).
| Part pin | Board pin |
|---|---|
| brown | GNDWire colour brown |
| red | 5VWire colour red |
| orange | D9Wire colour orange |
A starting servo can pull several hundred mA. On USB that comes straight from the computer's port, with no fuse on the board. More than one servo needs its own 5 V supply, with the grounds joined.