Navigation

  • index
  • modules |
  • next |
  • previous |
  • 16-223 Introduction to Physical Computing »
  • 2. Assignments »
  • 2.1. Unit 1 Exercises: Energy, Information, Transduction »

2.1.20. Exercise: Blink Bulb¶

2.1.20.1. Objective¶

Drive a light bulb from an Arduino program.

A microcontroller isn’t very useful without some kind of hardware attached. This exercise introduces driving an incandescent bulb from a digital signal. The transistor is used as a switch to control a higher current flow through the bulb than the Arduino output pin can sink, and at a voltage unsafe for the Arduino.

2.1.20.2. Steps and observations¶

  1. Adjust the lamp power supply for a safe full-on voltage. (Many lab incandescent lamps are designed for less than than the 12V shown on the schematic.)
  2. Note that pin 13 is still connected to the onboard LED. Observe the bulb and LED activity.
  3. Add additional digitalWrite() and delay() statements to create a different blink pattern.

2.1.20.3. Comments¶

This simple example cannot drive two separate patterns on two pins simultaneously, since it just stalls during delay(). Much of the challenge of programming a multi-function Arduino program comes down to structuring control flow so the program never stalls so it can service multiple inputs and outputs simultaneously.

For a challenge, restructure this program to use millis() to test for the loop cycles on which to change the output state, then add a second channel of output with different timing. This will covered in more detail in a later exercise.

../../../_images/blink-bulb_bb.png ../../../_images/blink-bulb_img.jpg ../../../_images/blink-bulb_schem.png

2.1.20.4. Other Files¶

  1. Fritzing file: blink-bulb.fzz
  2. EAGLE file: blink-bulb.sch

Table Of Contents

  • 2.1.20. Exercise: Blink Bulb
    • 2.1.20.1. Objective
    • 2.1.20.2. Steps and observations
    • 2.1.20.3. Comments
    • 2.1.20.4. Other Files

Previous topic

2.1.19. Exercise: Coding, Compiling, Deploying

Next topic

2.1.21. Exercise: Blink Motor

Quick search

Navigation

  • index
  • modules |
  • next |
  • previous |
  • 16-223 Introduction to Physical Computing »
  • 2. Assignments »
  • 2.1. Unit 1 Exercises: Energy, Information, Transduction »
© Copyright 2015, Garth Zeglin. Last updated on 2016-04-15. Created using Sphinx 1.4.