Skip to content

+49 1626571232

info@openelab.io

🚀 Free Shipping from 30€ in Germany, 50€ in the EU!

Have Fun with M5Stack Unit NeoHEX

27 Mar 2025 0 Comments
Today we want to do something simple, so I choose the M5Stack Unit NeoHEX. It's a newbie-friendly product. Let's do it now.
M5Stack Glass Unit

M5Stack ATOM Lite

View Product
M5Stack Speaker 2 Hat

M5Stack Neo HEX

View Product
I'd like to use M5Stack ATOM Lite be a micro controller, this is a tiny ESP32 Pico chip product, includes 4MB SPI flash memory, it also have WiFi on board, so we can connect to our home assistant system in easy way.

Connect

First of all, we use the Grove cable Connect ATOM Lite and NeoHEX together like this:

After that, we connect ATOM Lite and our computer.
If you don't know how to upload code into M5Stack, check these articles first:

Code

Open your Arduino IDE. Don't know how to use Arduino IDE? Check this:
Libraries we need:
  1. Include libraries

#include <M5Atom.h>
#include "FastLED.h"
  1. Define hardware

#define Neopixel_PIN_26 26
#define Neopixel_PIN_32 32
#define NUM_LEDS 37
  1. Brightness

CRGB leds[NUM_LEDS];
int brightness = 128; //50% light, 0-255
  1. Setup

void setup() {
M5.begin(true, false, true); // Initialize M5Atom without Serial, I2C and LED
M5.dis.drawpix(0, CRGB::Black); // Turn off the onboard LED
// Initialize LEDs on both pins
FastLED.addLeds<WS2811, Neopixel_PIN_26, GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.addLeds<WS2811, Neopixel_PIN_32, GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(64);
}
  1. Loop

void loop() {
// Define the arrow pattern for your custom layout
int arrowPattern[37] = {
0, 0, 0, 0, // Row 1: 4 LEDs
0, 0, 0, 1, 0, // Row 2: 5 LEDs
0, 0, 0, 0, 1, 0, // Row 3: 6 LEDs
0, 1, 1, 1, 1, 1, 0, // Row 4: 7 LEDs
0, 0, 0, 0, 1, 0, // Row 5: 6 LEDs
0, 0, 0, 1, 0, // Row 6: 5 LEDs
0, 0, 0, 0 // Row 7: 4 LEDs
};

for (int i = 0; i < NUM_LEDS; i++) {
if (arrowPattern[i] == 1) {
leds[i] = CRGB::Red; // Set LED to red
} else {
leds[i] = CRGB::Blac
k; // Turn off LED
}
}

FastLED.show();
delay(500); // Keep the arrow displayed
}

Results

It worked, a red arrow.

Upgrade

Pattern

Look at this part in the code:
void loop() {
// Define the arrow pattern for your custom layout
int arrowPattern[37] = {
0, 0, 0, 0, // Row 1: 4 LEDs
0, 0, 0, 1, 0, // Row 2: 5 LEDs
0, 0, 0, 0, 1, 0, // Row 3: 6 LEDs
0, 1, 1, 1, 1, 1, 0, // Row 4: 7 LEDs
0, 0, 0, 0, 1, 0, // Row 5: 6 LEDs
0, 0, 0, 1, 0, // Row 6: 5 LEDs
0, 0, 0, 0 // Row 7: 4 LEDs
};
Replace 0 with 1 to make your own patten

Color

Look at this part:

for (int i = 0; i < NUM_LEDS; i++) {
if (arrowPattern[i] == 1) {
leds[i] = CRGB::Red; // Set LED to red
} else {
leds[i] = CRGB::Black; // Turn off LED
}
}

Change your favorite color
If you want RGB color, use this code:

for (int i = 0; i < NUM_LEDS; i++) {
if (arrowPattern[i] == 1) {
leds[i] = CHSV((millis() / 10) + (i * 10), 255, brightness); // RGB color based on time
} else {
leds[i] = CRGB::Black; // Turn off LED
}
}

It looks like this:

So much fun, get your own NeoHEX right now, hurry up!
Subscribe to our newsletter for the latest updates on cutting-edge AIoT solutions and exclusive product discounts!
Follow us on X / LinkedIn to stay connected for upcoming meetups and cutting-edge IoT projects!
Join our WhatsApp AIoT Hero Community to network with AIoT professionals and share your innovative ideas!

 

Prev Post
Next Post

Leave a comment

All blog comments are checked prior to publishing

Someone recently bought a

Thanks for subscribing!

This email has been registered!

Shop the look

Choose Options

Recently Viewed

Edit Option
Back In Stock Notification
this is just a warning
Login
Shopping Cart
0 items
RuffRuff App RuffRuff App by Tsun