codeadamca / arduino-neopixel-ring

A basic example of controlling a NeoPixel ring using an Arduino.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arduino and a Neopixel Ring

A basic example of controlling a NeoPixel ring using an Arduino.

Arduino Code

Open up Arduino Create and add the following code:

#include <Adafruit_NeoPixel.h>

#define PIN 6

#define NUMPIXELS 16

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(
  NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayLength = 100;

void setup() {

  pixels.begin();
  pixels.show();

}

void loop() {
  
  for(int i=0; i<NUMPIXELS;i++) {
    
    pixels.setPixelColor(i,pixels.Color(20,0,0));
    pixels.show();
    
    delay(delayLength);
    
  }
  
  for(int i=0; i<NUMPIXELS;i++) {
    
    pixels.setPixelColor(i,pixels.Color(0,0,20));
    pixels.show();
    
    delay(delayLength);
    
  }

}

View the Arduino code on Arduino Create

You will need to setup the following circuit using your Arduino:

Tinkercad Circuit

View the Circuit on Tinkercad

Tutorial Requirements:

Full tutorial URL: https://codeadam.ca/learning/arduino-neopixel-ring.html

About

A basic example of controlling a NeoPixel ring using an Arduino.


Languages

Language:C++ 100.0%