Arduino TKJHAT
Arduino library for Pico HAT extension board
Loading...
Searching...
No Matches
Button.ino
1/*
2 Button Example
3
4 This example shows how to read a button using the TKJHAT library.
5 When the button is pressed, a message is printed to the Serial Monitor.
6
7 Circuit:
8 - Button connected via TKJHAT
9
10 created 2026
11*/
12
13#include "TKJHAT.h"
14
15// Create an instance of the TKJHAT class to access the peripherals
16TKJHAT hat;
17
18
19// Button and serial initialization
20void setup() {
21 Serial.begin(9600);
22 hat.button1.begin();
23}
24
25
26void loop() {
27 // Check if button 1 is pressed
28 if (hat.button1.isPressed()) {
29 Serial.println("Button 1 Pressed!");
30 }
31 // Small delay to avoid flooding the Serial Monitor
32 delay(100);
33}
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.