ArduinoGeneral

DFR0605 Gravity: Digital RGB LED Module

userHead Account cancelled 2021-06-19 07:32:21 436 Views0 Replies
I have modified the attached code. Original author attributes included. This is an example sketch on using just one RGB Module.

RGB chart link: https://www.rapidtables.com/web/color/RGB_Color.html

DFRobot Uno R3
IDE 1.8.15
Code: Select all
// Original NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#define PIN        12         // Which pin on the Arduino is connected to the NeoPixels?
#define NUMPIXELS 1           // How many NeoPixels are attached to the Arduino?
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() 
  {  
      pixels.begin();         // INITIALIZE NeoPixel strip object (REQUIRED)
      pixels.clear();         // Set all pixel colors to 'off'
  }

void loop() 
  {
       pixels.setPixelColor(0, pixels.Color(0, 255, 0));
      //pixels.setPixelColor(# of Modules;Zero is One module ,pixels.Color(R value, G value, Blue Value) 
      pixels.show();   // Send the updated pixel colors to the hardware.
  }