You must first complete Countdown Timer Basics before viewing this Lesson

Adding Screen Elements to Timer

Introduction

We will now start porting over the timer elements to the Little Python Brain. We will start by showing the timer seconds themselves on the screen.

Components Needed

  • Little Python Brain
  • A tablet/phone/laptop
Steps

1

Adding screen elements

Simply initialize control of the screen by dragging both of these blocks to the top of the blocks.

2

Clearing the screen and printing the time

As with previous projects, we need the oled.fill(0) to clear out the screen and the oled.show() blocks to write the information that we specify using the oled.text() block. 

As for the oled.text() block, simply type “Time: ” followed by a plus sign and a string conversion of the variable second.

3

Time's Up!

Finally, we do the same thing with the “Time’s Up!” indicator after the main loop.

The Complete Code

Run the code! Next up, we’ll learn how to make a self-contained timer app using just the touchpad and the screen. No need to manually type in the timer seconds!

Back to: Intermediate > Countdown Timer

CONTACT US

    Log in with your credentials

    or    

    Forgot your details?

    Create Account