Sketches for uC Expansion Bd

Click .gif for video Feature Sketch Description


 - D3, D4, D5





Red, green, blue LED with common cathode (-) connection.


This program outputs many colours and brightness levels by mixing the input parameters. There are six colour changes.

Piezo-Buzzer Speaker

 - D6, D7



When a switch is pressed, an LED is illuminated and a brief tone/melody is played on the piezo buzzer.

The time between the 10 tones can be varied.

Switches & LEDs

 - LEDS: D3, D4, D5

 - Switches: D7, D8, D9

Switches_LEDs.zip When a left, center or right switch is pressed, the corresponding red, green or blue LED is illuminated briefly.

LDR: Light Dependent Resistor

 - LDR: A0

 - LEDs: D3, D4, D5


Three LEDs arranged like a traffic light illuminate in succession as the light is reduced above the LDR.

PIR Motion Sensor Module

 - A2

PIR_01.zip The LED connected to D13 will illuminate when the signal from the PIR goes from 0v to 5v after detecting movement. Note how the LED stays lit until the movement ceases.

SD Card Module

 - SPI: D10, D11, D12, D13

 - A0









Link to more SD functions

Write a test file to the SD card.


Read the contents of a file previously written to.


List the SD card's files in the root folder.


List the SD card's folders and files.

DS1307 RTC Real Time Clock

 - I2C: A4 (SDA), A5 (SCL)





Prints the current date, day-of-the-week and time on the serial monitor. Once initialized by your PC's clock, the date and time will be backed up by the coin cell battery. This link will provide info on the RTClib.

This program works the same as SdFilesList but now the most recent files are timestamped with the current date & time, thanks to the RTC.

BME280 sensor Module

 - I2C: A4 (SDA), A5 (SCL)


Adafruit sensor provides temperature, humidity and barometric pressure.

I included the ability to measure the Humidex temperature (https://en.wikipedia.org/wiki/Humidex#Computation_formula).

Altitude can be roughly calculated based on current BP.

OLED 128x64 Display Module

 - I2C: A4 (SDA), A5 (SCL)

 - D2 (Reset)



Adafruit OLED 1.3" 128x64 display  test facility



Tags: Arduino-type Microcontroller, ATMega328P