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.
The F401 has no DAC, so analogWrite() makes PWM: D9 switches on and off 1000 times a second and the duty sets the brightness. A knob on A0 picks the duty.
| Pin | Connects to | What it does |
|---|---|---|
D9 | 220 Ω resistor, then the LED's long leg | PWM output: 1 kHz, 8-bit duty. |
A0 | The knob's wiper | ADC input, 0-4095. |
3V3 | One end of the knob | The top of the knob's range. |
GND | The knob's other end and the LED's short leg | Common ground. |
Sensors and actuators this board drives, with the real connections.
An LED on PWM pin D9 through 220 Ω: about 5 mA from 3.3 V.
| Part pin | Board pin |
|---|---|
| A | D9Wire colour orange |
| K | GNDWire colour black |
Always use a resistor. A blue or white LED needs about 3 V itself, so from a 3.3 V pin it glows only faintly.
Ends to GND and 3V3, wiper to A0: analogRead() gives 0-4095 after analogReadResolution(12).
| Part pin | Board pin |
|---|---|
| 1 | GNDWire colour black |
| W | A0Wire colour yellow |
| 3 | 3V3Wire colour red |
Power it from 3V3, never 5V: an ADC input in analog mode takes 4.0 V at most, and reads 4095 for anything above 3.3 V.
Signal on PWM pin D9; the 3.3 V pulse is enough for most hobby servos.
| Part pin | Board pin |
|---|---|
| SIG | D9Wire colour orange |
| GND | GNDWire colour brown |
Power it from its own 5 V supply and join the grounds. On USB the whole board has 300 mA, and a servo starting takes more.