Sketch 01 First Light
This one is printed on page 11 of your book. Type it in yourself: copying it letter by letter is part of the chapter. If it won't upload, compare yours with this one, line by line.
// 01 First Light
// The Maker's Book of Origins, chapter 01. Type it from page 11, or copy it from here.
// makernest.com/origins/01
// MakerNest Origins is a brand of Innointel Global Private Limited.
#include <MakerNestOrigins.h>
void setup() {
machine.begin(1, "01|FIRST|LIGHT");
machine.homeShows(SHOW_A);
}
void loop() {
machine.update();
}
Your settings and your notebook stay saved on the board when you upload.
Wiring
Red is power, black is the way back, and every signal has its own colour. On the shield, black goes to G, red to V, the signal to S. Every time.
New this chapter
New this chapter
The whole shield, by the end of the book
On the bench: Light an LED from the battery on the breadboard
A circuit is a loop. Power leaves the battery, goes through the LED and comes back. Break the loop anywhere and the light goes out.
You need
- red LED (long leg is +)
- 220 Ω resistor (red, red, brown) × 2
- 9 V battery and its clip
On the breadboard
Build it
- Put the LED in the top half: long leg in column 5, short leg in column 6.
- Put one 220 Ω resistor from column 6 to column 8, and the second from column 8 to column 10. Two in a row, because 9 volts is a lot for one small LED.
- Push the 9 V clip's red wire into column 5, top half.
- Push the clip's black wire into column 10, top half.
- Snap the clip onto the 9 V battery. The LED lights.
Nothing in this circuit is clever. It lights because the loop is closed.
Turn the LED round so the long leg is in column 6. It stays dark, and nothing is broken: an LED only lets power through one way.
Swap one 220 Ω for a 10 kΩ. The LED gets much dimmer. A bigger resistor lets less through.
Safely: Never leave both resistors out. Nine volts straight into an LED destroys it in a second. Unclip the battery when you finish: it is the lamp's battery.
How the bench works
Bench sketches replace your chapter sketch while you use them. Your settings and your notebook stay saved on the board. When you finish, upload the chapter's sketch again and your machine is back exactly as it was.
While a bench sketch runs, the display and the ring freeze on whatever they last showed. That is normal.
If the light ring is still lit from your chapter sketch, switch everything off and on again before you start. It goes dark and stops using power the bench needs.
The breadboard has 17 numbered columns and two halves, top and bottom. The five holes in one column of one half are joined underneath. Nothing joins across the gap in the middle.
Every jumper from the shield has a female end: push it onto a shield pin. The male end goes into the breadboard. G, V and S are the same three pins you have used all book: ground, power, signal.
Never put a wire straight from V to G. That is a short circuit.
Ask Milo
Stuck, curious, or something looks wrong? Tell me what you see.
You can paste your code or an error message here too.