NeoPixel Jewel With Arduino | Arduino Project

by | Jun 2, 2022 | Arduino, Basic Coding, Coding

Home » Coding » NeoPixel Jewel With Arduino | Arduino Project

Introduction

Do you know how to connect NeoPixel Jewel with Arduino? If You don’t know, no worries, as in this tutorial, we are going to learn how to make this connection.

Before proceeding further, let me tell you what NeoPixel Jewel is. It is a beautiful round PCB having 7 smart RGB LEDs. Now, it’s time to Be the belle of the ball with the NeoPixel Jewel!

Supplies

In order to connect NeoPixel Jewel with Arduino, we will require the following components:

Components

Circuit Diagram

Steps To Connect NeoPixel Jewel Using Arduino

Step 1: Gather all the components in one place.

NeoPixel Jewel:

Step 2: Connect the Input pin of it to the 2 number pin of the Arduino Uno on the Digital side.

Step 3: Connect the Ground Pin of it to the GND pin of the Arduino Uno.

Step 4: Connect the Power pin of the Jewel to the 5V power supply of the Arduino Uno.

Source Code

#include <Adafruit_NeoPixel.h>
#define PIN 2
#define NUM_LEDS 7
int c = 0;
Adafruit_NeoPixel demo = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
demo.begin();
}
void loop()
{
uint32_t c1 = demo.Color(0, 255, 0);
uint32_t c2 = demo.Color(0, 100, 255);
uint32_t c3 = demo.Color(255, 0, 0);
uint32_t c4 = demo.Color(255, 100, 10);
uint32_t c5 = demo.Color(0, 0, 255);
uint32_t c6 = demo.Color(0, 115, 0);
uint32_t c7 = demo.Color(50, 0, 100);
uint32_t colors [7] = {c1, c2, c3, c4, c5, c6, c7};


for(int m = 0; m <= NUM_LEDS; m++)
{
demo.setPixelColor(m, colors[c]);
demo.show();
delay(100);
c++;


if(c == 7)
c=0;
}
}

Explanation of the Code

1. In the beginning, we have included a NeoPixel Library that is Adafruit_NeoPixel.

2. After that, we have initialized two variables to the pin number to which the NeoPixel Jewel is connected to the Arduino Uno, and the number of LEDs that the Neo pixel Jewel has is seven. And one more variable, ‘c’, is initialized to 0, which we will be using in our function.

3. Then, we have passed the parameters, first is the total number of LEDs in the NeoPixel jewel, the second is the pin number of the Arduino to which the NeoPixel jewel is connected, and the third one represents the Green, Red, and Blue color code along with the frequency of 800KHz of the NeoPixel jewel.

4. In the setup function, we are beginning the NeoPixel jewel.

5. In the loop function, we are storing the different colors in different variables using the color codes. Then, making an array of those colors and looping them in a for loop and showing the colors one after each with a delay of some time in milliseconds.

Output

After switching ON the Arduino, we will be able to see a beautiful NeoPixel Jewel with different colors in it.

NeoPixel Jewel With Arduino - Arduino Project

 

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *