makernestOrigins · all chapters

Origins · Chapter 01 · Sense

First Light

Teach a machine to feel.

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.

Download .ino
// 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

SENSOR AUNDER THE BASEGNDVCCDATROW 2GVSTHE SHIELD2345678910111213A4A5USEDTODAY

New this chapter

23.4DISPLAYUNDER THE BASEGNDVCCSCLSDAA4GVSA5SPOWER3V3THE SHIELD2345678910111213A4A5USEDTODAY

The whole shield, by the end of the book

GVSROW 2SENSOR AROW 3DIALROW 4DIALROW 5DIALROW 6BUZZERROW 7SENSOR BROW 8DOOR SWITCHROW 9SWITCH BOARDROW 11LIGHT RINGA4DISPLAYA5DISPLAYPOWER 3V3DISPLAY

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

On the breadboard

TOPBOTTOM+LED2202209V +9V −1234567891011121314151617

Build it

  1. Put the LED in the top half: long leg in column 5, short leg in column 6.
  2. 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.
  3. Push the 9 V clip's red wire into column 5, top half.
  4. Push the clip's black wire into column 10, top half.
  5. Snap the clip onto the 9 V battery. The LED lights.
What you'll see

Nothing in this circuit is clever. It lights because the loop is closed.

Break it on purpose

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.

Then try

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.

The Tripwire →