Spartronics4915
  • Introduction
  • Version Control and Git
    • Introducing Git and GitHub
    • Git Fundamentals
    • Next Level Git
    • Git Flow
    • FAQ: git, vi, bash shell
    • A Simple Tutorial
  • An Introduction to Java
    • Lesson 1: Introductory Syntax
    • Lesson 2: Variables and Datatypes
    • Lesson 3: Method Calls
    • Lesson 4: The If Statement
    • Lesson 5: Method Definitions
    • Lesson 6: Classes
    • Lesson 7: Inheritance
    • Helpful Programming Resources
  • Programming a Robot
    • Pre-Lesson: What is a Robot?
    • Setting up your Development Environment
    • Lesson 1: Motors and the Interative Robot
    • Lesson 2: What is a Subsystem?
    • Lesson 3: What are Commands?
    • Lesson 4: What are Command Groups?
    • Lesson 5: Scheduling Commands
  • Data Analysis
  • Arduino and Bling Development
    • Setup Arduino IDE
    • Starting with Bling
    • Spartronics Clock with NeoMatrix
    • Related Tutorials and Resources
Powered by GitBook
On this page
  • Bling Demo
  • Setup
  • Learning Path
  • Exercises and Code Experiments
  • Adafruit NeoPixel Documentation
  • Bling Code Samples

Was this helpful?

  1. Arduino and Bling Development

Starting with Bling

PreviousSetup Arduino IDENextSpartronics Clock with NeoMatrix

Last updated 4 years ago

Was this helpful?

Spartronics has two projects for introducing Arduino development using bling.

  • is a

    simple introduction with step by step demonstration of adding new

    functionality.

  • uses Adafruit

    NeoPixel strip and ring components to enable students with a sandbox

    environment for experimentation.

Important: If this is your first time diving into Arduino, make sure to walk through . Also, there are many good tutorials on YouTube, such as

Bling Demo

Introduction to bling development uses Adafruit NeoPixel strip and ring components. Demo board also has a potentiometer for demonstrating sensor interaction.

Setup

For sketch code and hardware requirements see

  • Board: Arduino Uno

  • If you need to install Arduino IDE, see instructions

  • [Install Adafruit NeoPixel

    Library]()

    to Arduino IDE

  • Clone BlingDemoSystem Repo. If you need help, see instructions

Learning Path

  • Introduce [Arduino Uno

    how to connect to power and computer, and general layout of the pins

  • Give an overview of Arduino IDE (how to compile, upload, configure

    IDE, ...) and introduce the term sketch which

    is an Arduino program

  • Review how sketch code is mapped to Arduino board and bling hardware:

    pins, NeoPixel configuration.

  • Discuss [Arduino sketch code

    setup() and loop() functions.

  • Introduce

  • Introduce simple debugging with println()

  • Show how potentiometer sensor is read and how NeoPixel is controlled.

    Also discuss [Arduino I/O

    pinMode(), digitalWrite() and

    analogRead() functions.

Exercises and Code Experiments

  • Understand RGB and pixel numbering by changing the setup() code on how the strip/ring is initialized.

  • Write new functions for different blink patterns:

    • rainbow

    • use potentiometer to change intensity of the leds without changing

      the blink pattern

    • use potentiometer to control the number of pixels change color on

      the strip: 0 everything off to 255 all pixels are on

  • Change blink rates and experiment with using light on/off as a

    communication tool.

Adafruit NeoPixel Documentation

Key sections:

  • Include library: #include <Adafruit_Neopixel.h>

  • Specify LED_PIN and LED_COUNT

  • Declare Adafruit_NeoPixel object -- can be a ring or a strip

    // Example for NeoPixel strip
    #define STRIP_PIN       4       // i.e. LED_PIN
    #define STRIP_PIXELS    30      // i.e. LED_COUNT
    // *strip* is the Adafruit_NeoPixel object
    Adafruit_NeoPixel strip = Adafruit_NeoPixel(STRIP_PIXELS, STRIP_PIN, NEO_GRB + NEO_KHZ800);
  • When using the NeoPixel function, make sure to specify the

    Adafruit_NeoPixel object

  • In setup() function call begin() to prepare data pin NeoPixel output

    void setup(void)
    {
      // Configure the serial terminal for debug output and user input
      Serial.begin(9600);
    
      // Initialize the pixels to get them ready for use
      strip.begin();
    }
  • Common commands -- don't forget to specify the NeoPixel object in the command strip.clear()

    • LED pixels numbered along the strip starting from 0 closest to the

      Arduino board

    • setting pixel colors:

      • setPixelColor(pixel_number, R, G, B) and RGB brightness levels

        -- 0 is dimmest (off) and 255 max brightest

      • setPixelColor(pixel_number, color) where color is a 32-bit

        type that represents RGB

      // Set up a rainbow pattern on the strip
      strip.setPixelColor(0, Adafruit_NeoPixel::Color(32, 0, 0));
      strip.setPixelColor(1, Adafruit_NeoPixel::Color(32, 32, 0));
      strip.setPixelColor(2, Adafruit_NeoPixel::Color(0, 32, 0));
      strip.setPixelColor(3, Adafruit_NeoPixel::Color(0, 32, 32));
      strip.setPixelColor(4, Adafruit_NeoPixel::Color(0, 0, 32));
      strip.setPixelColor(5, Adafruit_NeoPixel::Color(32, 0, 32));
      strip.setPixelColor(6, Adafruit_NeoPixel::Color(32, 32, 32));
      strip.show();
      
      // Setup a magenta color
      uint32_t magenta = strip_object.Color(255, 0, 255)
      • fill() function to set same color to multiple pixels

      • clear() function to turn off all pixels to 0 brightness

      • getPixelColor() to query existing pixel value

      • setBrightness() to specify brightness level of all pixels

  • show() to push the color data to the NeoPixel object, otherwise

    color changes will not be displayed

Bling Code Samples

Also see for reference.

board](),

structure]():

Introduce , ,

,

and

functions]():

Experiment with online and see how they perform on the NeoPixel.

See for documentation on how to use the library.

Arduino Tutorial
https://www.tutorialspoint.com/arduino/arduino_board_description.htm
https://www.tutorialspoint.com/arduino/arduino_program_structure.htm
data types
variables
functions
operators
control statements
loops
https://www.tutorialspoint.com/arduino/arduino_io_functions.htm
RGB colors
Adafruit NeoPixel Uberguide
Intro to Arduino
Spartronics Bling Code
Intro to Arduino
Bling Demo
Ladyada's Learn Arduino Tutorials
this one
BlingDemoSystem Repo
here
https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation
here