Arduino TKJHAT
Arduino library for Pico HAT extension board
Loading...
Searching...
No Matches
Display.ino
1/*
2 Display Example
3
4 This example demonstrates how to use the display functionality of the TKJHAT library.
5 It shows how to write text, draw lines and circles, and clear the display.
6
7 Circuit:
8 - SSD1306 display integrated in Pico HAT
9
10 created 2026
11*/
12#include "TKJHAT.h"
13
14// Create TKJHAT object which provides access to onboard components
15TKJHAT hat;
16
17// Initializes serial communication and the TKJHAT hardware
18void setup() {
19 Serial.begin(9600);
20 hat.begin();
21}
22
23void loop() {
24 // Write text to the display, wait for 2 seconds, then clear the display
25 hat.display.writeText("Hello HAT!");
26 delay(2000);
27 hat.display.clear();
28
29 hat.display.drawLine(0, 0, 127, 63); // Draw a diagonal line across the display
30 delay(2000);
31
32 hat.display.drawLine(0, 63, 127, 0); // Draw the opposite diagonal
33 delay(2000);
34
35 hat.display.drawCircle(64, 32, 20, false); // Draw an empty circle at the center of the display
36 delay(2000);
37
38 hat.display.clear();
39 hat.display.writeText("Goodbye!");
40 delay(2000);
41
42 hat.display.clear();
43 hat.display.stopDisplay(); // Power off the display
44}
Main interface for accessing TKJHAT board features.
Definition TKJHAT.h:35
void begin()
Initialize all peripherals on the HAT Also initializes the default I2C bus for sensors and display.