Learning Outcome

In this chapter, we learn to


Introduction: Button and Buzzer

Activities: Build a water drinking reminder (Hydration Companion)

Challenge: Program drinking reminder to accept user input for duration.

Introduction to Button

Buttons are essential electronic components in modern technology that allow us to input commands and interact with various devices. They come in all shapes and sizes, from the tiny buttons on your calculator to the larger ones on your computer keyboard.

    > Libraries <

-> Libraries: board, time, digitalio.

-> Button Configuration: Button A (Yellow) to GP0 as digital input.

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

Introduction to Buzzer

Want to make some noise with your EDU PICO? In this section, you will learn how to activate your EDU PICO built-in piezo buzzer. While you're at it, go ahead and hook up the EDU PICO to a headset or a speaker at the buzzer module too!

    > Libraries <

-> Libraries: board, simpleio.

-> Audio / Buzzer Configuration: Buzzer to GP21.

-> Action Required: Flip the buzzer module switch downwards to enable buzzer output.

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

Water Drinking Reminder

Hydration Companion

Let's build a water drinking reminder with EDU PICO! Don't worry, we will keep your first project simple. Ultimately, you will learn how to combine codes from multiple components. Let's Go!

    > Libraries <

-> Libraries: board, digitalio, time, simpleio.

-> Button Configuration: Button A (Yellow) = GP0, Button B (Blue) = GP1.

-> Input:

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

Challenges

#1 - Water Drinking Reminder

In the original code, the timer runs for only 5 seconds by default. In this challenge, you are required to modify the code to allow the user to customize the duration of the water-drinking reminder.

    > Libraries <

-> Libraries: board, digitalio, time, simpleio.

-> Button Configuration: Button A (Yellow) = GP0, Button B (Blue) = GP1.

< CircuitPython Code >

Click here to download code

< Expected Output >

Upon completion of the activity, you should be able to:

Complete! Well done on finishing Chapter 2! Keep the momentum going!