The Adafruit HalloWing is a versatile, Halloween-themed development board that is perfect for creating interactive projects and wearables. Based on the powerful ATSAMD21 microcontroller, it features a 1.44-inch color TFT display, user interface buttons, and a suite of onboard sensors. The HalloWing is designed to be easy to use for both beginners and experienced makers, with plenty of opportunities for customization and creativity.
Pin # | Function | Description |
---|---|---|
1 | VBAT | Battery input for an optional LiPo battery |
2 | EN | Enable pin, can be used to turn off the board |
3 | GND | Ground |
4 | USB | USB connection for programming and power |
5 | NeoPixel | Output to chainable NeoPixel LEDs |
6 | Light Sensor | Analog light sensor input |
7 | A0-D2 | General purpose I/O pin |
8 | SDA | I2C data line |
9 | SCL | I2C clock line |
10 | TX | UART transmit |
11 | RX | UART receive |
12 | Button 1 | User interface button |
13 | Button 2 | User interface button |
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <SPI.h>
// Pin configuration for the HalloWing connected to an Arduino UNO
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8
// Initialize the display
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
void setup() {
tft.initR(INITR_144GREENTAB); // Initialize display with the correct init code
tft.fillScreen(ST7735_BLACK); // Clear the screen to black
}
void loop() {
tft.setCursor(0, 0); // Set the cursor at the top-left corner
tft.setTextColor(ST7735_WHITE); // Set the text color to white
tft.setTextWrap(true); // Allow text to wrap after 80 characters
tft.print("Happy Halloween!"); // Print a message to the screen
delay(2000); // Wait for 2 seconds
tft.fillScreen(ST7735_BLACK); // Clear the screen
delay(500); // Wait for half a second
}
Remember to wrap the code comments as needed to limit line length to 80 characters. This example demonstrates how to initialize the display and print a simple message. Adjust the pin configuration to match your setup if you're not using the default pins.
For more detailed information, refer to the Adafruit HalloWing guide and datasheets available on the Adafruit website.