Home
Electronic Tech
Header Ads Widget
Home
4 neo pixel sinewave animation
4 Neopixel Sine Wave Animation | Arduino Tutorial
4 Neopixel Sine Wave Animation | Arduino Tutorial
Waqas Farooq
September 04, 2020
Circuit Diagram
Code of this project
#include
//Basic sine wave animation for NeoPixel Ring Bangle Bracelet //by Dano Wall and Becky Stern for Adafruit Industries #define PIN 3 #define NUM_LEDS 64 // Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type: // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB); uint32_t color = strip.Color(250, 14, 14); // Change RGB color value here // These are the pixels in order of animation-- 36 pixels in total: int sine[] = { 4, 3, 2, 1, 0, 15, 14, 13, 12, 20, 21, 22, 23, 24, 25, 26, 27, 28, 36, 35, 34, 33, 32, 47, 46, 45, 44, 52, 53, 54, 55, 56, 57, 58, 59, 60 }; void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' strip.setBrightness(180); // 40/255 brightness (about 15%) } void loop() { for(int i=0; i<36; i++) { strip.setPixelColor(sine[i], color); // Draw 'head' pixel strip.setPixelColor(sine[(i + 36 - 8) % 36], 0); // Erase 'tail' strip.show(); delay(40); } }
Post a Comment
1 Comments
Anonymous
February 20, 2022 at 9:51 PM
This comment has been removed by a blog administrator.
Reply
Delete
Replies
Reply
Add comment
Load more...
Most Popular
Arduino Tutorial Interfacing Two Stepper Motor using an Arduino, and Joystick
August 30, 2021
LED pattern with button control on Arduino | Arduino Tutorial
October 01, 2020
Connect Multiple Ultrasonic Sensor with Arduino
April 15, 2021
Contact form
1 Comments
This comment has been removed by a blog administrator.
ReplyDelete