Little Bird Curriculum / code littlebird.com.au
lorikeet_arduino.ino Arduino (C/C++) 25 lines · 4 views Raw Download Embed view
#include <Adafruit_NeoPixel.h>

const byte DATA_PIN = 3;
const byte LED_COUNT = 5;
const byte LEVEL = 24;                 // Keep this first USB-powered test dim.
const unsigned long HOLD_MS = 1000;
Adafruit_NeoPixel pixels(LED_COUNT, DATA_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
  pixels.clear();
  pixels.show();
}

void showColour(byte red, byte green, byte blue) {
  pixels.fill(pixels.Color(red, green, blue));
  pixels.show();                       // Send the buffered colours to all five LEDs.
  delay(HOLD_MS);
}

void loop() {
  showColour(LEVEL, 0, 0);
  showColour(0, LEVEL, 0);
  showColour(0, 0, LEVEL);
}

Embed this snippet

As an iframe:

Or drop it inline with a script tag (injects the highlighted block where included):

Shared from Little Bird Electronics curriculum.

Copied to clipboard