Lesson plan

Build a slot machine lesson plan

Pull a real arcade lever, spin three OLED reels and pay out by a table whose odds you can check, on an Uno.

2 chapters, 4 lessons, about 4 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

The unit

Objectives and materials

By the end, students can

  • Read the lever once per pull, and draw a reel that spins.
  • Three reels on three buses, then credits, bets and honest odds.

Materials for the whole unit

  • Addressable RGB LEDs
  • Arcade button x 3
  • Arcade joystick lever
  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64 x 3
  • Piezo speaker

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 50 min

Lever and reel

Read the lever once per pull, and draw a reel that spins.

LessonTimeWhat students do
Slot machine: the leverA real arcade lever on an Uno. Read its DOWN switch, count each pull exactly once on its edge, and give it a click you can hear.55 min
  1. Four switches in a stick
  2. Pull it
  3. Watch the pin
  4. Give it a click
Slot machine: one reelDraw a spinning reel on an SSD1306 with no frame buffer, then let the lever pick where it stops. Animation that fits in an Uno.55 min
  1. A reel on a screen
  2. No frame buffer
  3. Spin
  4. The clunk

Materials

  • Arcade joystick lever
  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64
  • Piezo speaker

Check for understanding

Each student finishes "Slot machine: one reel" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "The clunk".

Chapter 2. About 2 h 15 min

The machine

Three reels on three buses, then credits, bets and honest odds.

LessonTimeWhat students do
Slot machine: three reelsThree OLEDs with the same address, each on its own pair of wires, and reels that stop one by one from left to right.55 min
  1. Three screens, one address
  2. All three drawn
  3. Pull, and watch them stop
  4. Read the line
Slot machine: the whole machineCoins, a bet, a pay table with odds you can check, win lights and sounds. The finished machine, and the math that keeps it honest.80 min
  1. The finished machine
  2. Drop a coin
  3. Set the bet
  4. Spin
  5. Get paid
  6. Out of credits

Materials

  • Addressable RGB LEDs
  • Arcade button x 3
  • Arcade joystick lever
  • Arduino Uno R3
  • Full-size breadboard
  • OLED display, 128x64 x 3
  • Piezo speaker

Check for understanding

Each student finishes "Slot machine: the whole machine" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Out of credits".

Your class

Teach this unit as a class

Start a class from this course and its 4 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.