Developmental Project 2.00 Mind the Dog

The program demonstrates how embedded systems can track time without stopping the program. Instead of using delay(), which pauses execution, it uses the millis() timestamp technique to calculate elapsed time. This allows multiple tasks—timers, display updates, and LED indicators—to run simultaneously.

Mind the Dog is a middle–high school computer science lesson designed for the 1ST Maker Frog (Uno R4 Minima) platform. The project teaches students key embedded programming concepts by building a device that tracks the elapsed time since two dogs were last taken outside. Each dog has its own timer displayed on an OLED screen, and pressing a button resets the corresponding timer

Project Code:

				
					

//Libraries:
#include "Arduino.h"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_NeoPixel.h>    // V 1.12.3
#include <Adafruit_GFX.h>         // V 1.11.11
#include <Adafruit_SSD1306.h>     // V 2.5.13
#include <IRremote.h>             // V 4.4.1

// IR Pins
#define DECODE_NEC
const uint8_t IRTxPin = 5;    // Infrared transmit pin
const uint8_t IRRxPin = 3;    // Infrared receive pin

// OLED constants
const uint8_t SCREEN_WIDTH   = 128; // OLED display width, in pixels
const uint8_t SCREEN_HEIGHT  = 64; // OLED display height, in pixels
const uint8_t OLED_RESET     = -1; // Reset pin # (or -1 if sharing Arduino reset pin)
const uint8_t SCREEN_ADDRESS = 0x3C; ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32

// These are the four LEDs on the Frog's cheeks
const uint8_t LEDs[4] = {13, 6, 7, 8};

// These are the left and right buttons
const uint8_t BUTTON_ONE = 1;
const uint8_t BUTTON_TWO = 0;

// Buttons go LOW when pressed
const bool PRESSED = LOW;

// These are the two NEO-PIXEL "Eyes"
const uint8_t NUM_NEO = 2;
const uint8_t NEO_PIN = 10;

// This is the Piezo Sounder
const uint8_t PIEZO = 12;

// This is the Potentiometer pin
const uint8_t POT_PIN = A0;

// This is the Light Sensor pin
byte lightSensorPin = A2;

// This is the Temperature Sensor pin
byte tempSensorPin = A3;

// This is the 1ST Maker Space logo
#define LOGO_HEIGHT 64
#define LOGO_WIDTH 128
const unsigned char logo_bmp [] PROGMEM = {
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xc3, 0xe3, 0x87, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xc7, 0xf3, 0x87, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xc7, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xc1, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x07, 0xe0, 0x3f, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xfe, 0x07, 0xf8, 0x0f, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xfe, 0x07, 0xfe, 0x07, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xfe, 0x07, 0xff, 0x83, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xfe, 0x07, 0xcf, 0xc3, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xfe, 0x07, 0xc7, 0xe3, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc7, 0xe3, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe0, 0x03, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe0, 0x07, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc1, 0xfe, 0x0f, 0x07, 0xe7, 0xe6, 0x00, 0x18, 0x03, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc0, 0x78, 0x0e, 0x03, 0xe7, 0xc7, 0x00, 0x18, 0x01, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe0, 0x30, 0x1e, 0x73, 0xe7, 0x8f, 0x1f, 0xd9, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x33, 0x9c, 0xf9, 0xe7, 0x1f, 0x1f, 0xf9, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x33, 0x9c, 0xf9, 0xe6, 0x3f, 0x1f, 0xf9, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x33, 0x9c, 0xf9, 0xe0, 0x7f, 0x1e, 0x79, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x33, 0x9c, 0xf9, 0xe0, 0xff, 0x00, 0x78, 0x03, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x33, 0x9c, 0xf9, 0xe0, 0xff, 0x00, 0x78, 0x07, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x03, 0x9c, 0x01, 0xe4, 0x7f, 0x1e, 0x78, 0x07, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x87, 0x9c, 0x01, 0xe6, 0x3f, 0x1f, 0xf9, 0xe3, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0x87, 0x9c, 0xf9, 0xe7, 0x1f, 0x1f, 0xf9, 0xf1, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe7, 0xcf, 0x9c, 0xf9, 0xe7, 0x8f, 0x1f, 0xd9, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc3, 0xff, 0x0c, 0xf9, 0xe7, 0xc7, 0x00, 0x19, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc3, 0xff, 0x0c, 0xf9, 0xe7, 0xe6, 0x00, 0x19, 0xf9, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe0, 0x1e, 0x00, 0x7f, 0x07, 0xfc, 0x03, 0xe0, 0x01, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc0, 0x0f, 0x00, 0x3e, 0x03, 0xf8, 0x01, 0xf0, 0x01, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xcf, 0xcf, 0x3f, 0x3e, 0x73, 0xf1, 0xf8, 0xf1, 0xfd, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc7, 0xff, 0x3f, 0x3c, 0xf9, 0xe3, 0xfc, 0xf1, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe3, 0xff, 0x3f, 0x3c, 0xf9, 0xe3, 0xff, 0xf1, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xf1, 0xff, 0x3f, 0x3c, 0xf9, 0xe3, 0xff, 0xf1, 0xe7, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xf8, 0xff, 0x00, 0x3c, 0xf9, 0xe3, 0xff, 0xf0, 0x07, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xfc, 0x7f, 0x00, 0x7c, 0x01, 0xe3, 0xff, 0xf0, 0x07, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xfe, 0x3f, 0x1f, 0xfc, 0x01, 0xe3, 0xff, 0xf1, 0xe7, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xff, 0x1f, 0x1f, 0xfc, 0xf9, 0xe3, 0xfc, 0xf1, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xcf, 0x8f, 0x1f, 0xfc, 0xf9, 0xf1, 0xf8, 0xf1, 0xfd, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xc0, 0x0f, 0x1f, 0xfc, 0xf9, 0xf8, 0x01, 0xf0, 0x01, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x07, 0xe0, 0x1f, 0x1f, 0xfc, 0xf9, 0xfc, 0x03, 0xe0, 0x01, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0x80, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

// Constructors for the dispay and the NeoPixel Frog eyes
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
Adafruit_NeoPixel pixel(NUM_NEO, NEO_PIN, NEO_RGB + NEO_KHZ800);
				
			

*If you’re copying and pasting the code, or typing from scratch, delete everything out of a new Arduino sketch and paste / type in the above text.

Learn More In Our Free Instructional Guidebook

This comprehensive guidebook for the 1st Maker Space Microcontroller Trainer provides a comprehensive introduction to the world of Arduino programming for beginners. It guides users through the foundational concepts of microcontrollers, detailing the unique features of the Arduino Leonardo-compatible MCU Trainer board. The manual offers a step-by-step journey from understanding the hardware components and the Arduino programming language to the vibrant global community of Arduino enthusiasts. It delves into the intricacies of each onboard circuit, explaining their functionalities and applications. With a focus on hands-on learning, the manual includes a series of coding exercises, tutorials in C/C++, and insights into the Arduino IDE.

More Projects

Project 1.00 Blink

In this project, you’ll learn how to blink an LED!

Project 1.01 Blink x2

In this project, you’ll learn how to blink more than one LED!