Week 10 · Extension & Project Planning

Session 47: Extension workshop: interrupts and the clock alarm

Teach & buildFlex120 minLesson 29: Interrupts on the Uno · Lesson 28: Capstone 2: Clock, Alarm & Servo

Learning outcomes

  • Use an external interrupt on D2 with a volatile flag
  • Explain what may and may not happen inside an ISR
  • Combine the RTC, LCD, servo and buzzer in the clock alarm state machine

Kit and components

  • Uno, push button, LED, passive buzzer
  • For the clock alarm: RTC, I2C LCD, servo and separate supply

Pre-reading about 20 min

Students read these on their phones before class. They are listed on the student Before class page.

  1. Lesson 29: ISR rules (all interrupt types)
  2. Lesson 29: Flag in ISR, work in loop
  3. Lesson 28: Alarm states

Session plan

  1. 0:0010 min
    Recap

    Task C reflections

  2. 0:1025 min
    Demo

    Interrupts in one rule

    Set a flag in the ISR and do the work in loop(). Show what goes wrong when Serial is called inside an ISR.

  3. 0:3530 min
    Build

    Interrupt worked sketch

    Students build the worked sketch and add the lesson challenge: ignore further interrupts for 200 ms.

  4. 1:0545 min
    Build

    Clock alarm capstone or Task C extension

    Students whose final project needs an alarm or scheduling build the clock alarm capstone; others extend their Task C controller.

  5. 1:5010 min
    Wrap-up

    Which technique does your project need?

Checkpoint: ready to move on?

Students can state the ISR rules and have either an interrupt sketch with a debounce window or a progressing clock alarm build.

Extension for fast finishers

Read the optional appendix templates - timer interrupt, sleep and wake - that apply to their project.

Catch-up path

Skip the capstone and complete the interrupt sketch only.

Homework and practice

Update the final project plan with any new techniques.

Facilitator notes

  • Flex session: in a shorter course the extension workshops become final project research time.