SlideShare a Scribd company logo
Having fun with an Arduino Nano & FastLED
By: Andrew Tuline
Programming Addressable LED Strips
or
Overview
• Introductions
• To program or not to program
• Install IDE and check out drivers
• Included examples
• More examples
• Some reference material
• Create your own project
Work on your own or with partners, and help each other out.
This Workshop
If you wish to program:
• Assumes you’re familiar with .zip files, folders
• Basic C++ programming
• We’ll try several cool lighting examples
Your Arduino is already programmed with an awesome
demo, so you don’t NEED to re-program it.
Installing Arduino Software
• On Windows 7
• Installs to C:Program Files (x86)Arduino
• Your programs are in C:UsersuseridDocumentsArduino
• ‘Tools | Board’ should be changed to say ‘Arduino Nano w/
ATmega328’
• In Device Manager, see ‘Ports (COM & LPT)’
• Device drivers in C:Program Files (x86)ArduinodriversFTDI
USB Drivers (we may be using another set of drivers)
Are you running 32 bit or 64 bit?
Touring the IDE
• ‘File | Examples’ includes lots of examples
• ‘File | Upload’ is how we compile and upload our program to
the Arduino
• ‘Help | Reference’ includes a local copy of the Language
Reference
Make GOOD use of those examples!
Test the Drivers
Declare constants & global variables
One time setup of ports
Continuous loop
Test your drivers by compiling and uploading Blink.ino
Arduino Nano Pins
• Digital pins (input/output)
• Analog pins (input/output)
• Vin, Ground pins
• 5V, 3.3V pins
• Analog out is PWM
• Most pins support other functions
This project uses Vin, 5V, Ground and a few digital pins
Addressable LED Strips
• Traditionally, we assign output values to each
R, G and B pin on each LED
• This can use up a LOT of pins
• Addressable LED strips provide circuitry to
communicate serially
LED Strip Connections
D12 –
D11 –
5V –
Gnd –
D6 –
Vin –
Data in
Clock in
5V
Gnd
Button
Battery +
We’re using APA102 LED’s, aka DotStars
What is FastLED?
• FastLED is a fast, easy-to-use Arduino library
for programming addressable LED strips.
• FastLED is used by thousands of developers.
• It’s FAST!
Do a YouTube search for ‘FastLED’
Downloading FastLED
• The latest version is on GitHub at:
https://github.com/FastLED/FastLED
• Download the zip file.
• Extract the directory FastLED-master.
• Rename the directory from:
FastLED-master to FastLED
• Place that directory into:
C:Program Files(x86)Arduinolibraries
FirstLight Example
• In the Arduino IDE, select
‘File | Examples | FastLED | FirstLight’
• We need to change the type of LED’s.
• We need to change the data (and clock) pins.
• We need to change the number of LED’s.
• We then need to change the definition.
We may need to change colour order!
FirstLight Code
#include "FastLED.h"
#define NUM_LEDS 20
#define DATA_PIN 12
#define CLOCK_PIN 11
uint8_t max_bright = 64;
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(max_bright);
}
void loop() {
for (int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed++) {
leds[whiteLed] = CRGB::White;
FastLED.show();
delay(100);
leds[whiteLed] = CRGB::Black;
}
}
The white LED should march across the array. Try red!
// Include the library
// Number of LED’s
// Our data pin
// Our clock pin
// Define brightness limiter
// Define the LED array
// Run once
// Initialize the LED array
// Limit the brightness
// Run continuously
// Cycle through each LED in the array
// Set the current one white
// Show it
// Wait for a bit
// Set it to black
Setting LED values
• leds[9] = CRGB::Cyan; // Web colours
• leds[9].g = 255; // Just set green
• leds[0] = CRGB(255,0,0); // CRGB values (red, green, blue)
• leds[0] = 0x0000ff; // Use a hex #
OR
• leds[9] = CSHV(hue, sat, bright); // Each goes up to 255
FastLED provides lots more ways to assign colours to LED’s
Variable Types
Variable types include:
– int (-32768 to 32767 is 16 bit signed)
– uint (0 to 65535 is 16 bit unsigned)
– uint8_t (0 to 255 is 8 bit unsigned)
– long (is 32 bits signed)
– and many more. . .
Variable scope can also be important as well
Random Numbers
long num = random(); // 32 bit
uint8_t unum = random8(); // 8 bit
int inum = random16(0, 1023); // 16 bit
• The ‘long’ can be used to assign random RGB colours
• The ‘uint8_t’ can be used to assign hue, brightness values
• It can also refer to LED elements in your strip
random8() and random16() are FastLED functions
If Statements
This example occasionally flashes a random colour on a random LED.
void loop() {
uint8_t j = random16(0, 100); // Which LED will we light up
if ( j < NUM_LEDS ) { // Only display if that number IS in our array
leds[j] = random(); // 32 bit randomizer for colour
FastLED.show();
delay(100);
leds[j] = CRGB::Black; // Make that LED black again
}
}
For Loops
This example sets each LED a different colour, waits 2 seconds and repeats.
void loop() {
for (int i = 0; i < NUM_LEDS; i++) { // Last element is leds[NUM_LEDS-1]
leds[i] = random(); // A 32 bit random number
}
FastLED.show();
delay(2000);
}
We’re Just Getting Started
FastLED contains a LOT of functions including:
• Random number generation
• Fast 8 and 16 bit basic math functions
• Fast trigonometry
• Setting RGB and HSV values
• fill_rainbow, fill_gradient, fading, scaling, blending, noise,
palettes
• Power management
We’re talking FAST
Rainbow March
#include "FastLED.h"
#define LED_DT 12 // Data pin
#define LED_CK 11 // Clock pin
#define NUM_LEDS 20 // Number of LED's
#define COLOR_ORDER GRB // Change the order as necessary
#define LED_TYPE APA102 // What kind of strip are you using?
uint8_t max_bright = 64; // How bright do we want to go
struct CRGB leds[NUM_LEDS]; // Initialize our array
uint8_t thisdelay = 8; // A delay value for the sequence
uint8_t thishue; // Starting hue value.
uint8_t deltahue = 5; // Difference in hue between LED’s
Use variables where possible
Rainbow March cont’d
void setup() {
LEDS.addLeds<LED_TYPE, LED_DT, LED_CK, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(max_bright);
}
void loop () {
rainbow_march();
FastLED.show();
delay(thisdelay);
}
void rainbow_march() {
thishue++;
fill_rainbow (leds, NUM_LEDS, thishue, deltahue); // FastLED does the heavy lifting
}
More FastLED Demos
• There’s also several 3rd party demos at:
https://github.com/atuline/FastLED-Demos
• Unzip and store them in:
C:users<username>DocumentsArduino
Try More Demo’s
• Try one_sine
• Try one_sine demo
• Try pop_fade_demo
• Try ripple
• Try two_sin_demo
• Try noise16_demo
• Try three_sin_demo
• Try rainbow_march_demo
Don’t forget the FastLED examples
Google for more FastLED
Arduino Research
• www.fastled.io
• github.com
• arduino.cc/tutorial
• playground.arduino.cc
• tronixstuff.com/tutorials
• learn.sparkfun.com/tutorials
• oomlout.com/a/products/ardx
Don’t forget the examples included with the Arduino software
Inspirational Web Sites
• www.instructables.com
• www.tindie.com
• www.makershed.com
• www.makezine.com
Sources for Parts
• www.robotshop.ca
• www.sparkfun.com
• www.leeselectronics.com
• www.gravitech.us
• www.adafruit.com
• www.ebay.ca
• www.aliexpress.com
• www.amazon.com
• www.dealextreme.com
All it takes is a VISA card and your imagination
Local Events
• North Delta Luminary Festival
• Vancouver Mini Maker Faire
• WestSurDel Fun Night
• Vancouver Bike Rave
• Christmas events
• Any night market
Then there’s Burning Man
University
Hardware Hacker
https://diy.org/skills/hardwarehacker
Light Something

More Related Content

What's hot (20)

PPT
Lockout tagout
Engr Jamali
 
PPT
Electrical Safety
Reliance
 
PDF
Industrial electrical safety
vtsiri
 
PPTX
Overhead and gantry cranes safe operating procedures
ytcrane
 
PDF
Farana crane safety- B: Proactive magazine.pdf
CORE EHS
 
PPT
LOTO Training.ppt
Bimal Chandra Das
 
PPT
Working at heights
Chitra Mohanty
 
PDF
LOCKOUT-TAGOUT-SAFETY PRESENTATION-CONTROL OF HAZARDOUS ENERGY
jasonmorgan
 
PPTX
Electrical safety slideshare
YokeshDhanabal
 
PPT
Undertake basic electrical tasks
catherinelindsay
 
PDF
Safety in Mechanical Industries
Verde Ventures Pvt. Ltd.
 
PPT
RAILWAY WORKSHOP TRANING PPT
Sahil arora
 
PPTX
Inplant Training - Integral Coach Factory
Sudarshan Mohan
 
PDF
Electrical safety ppt
construction
 
PDF
material safety data sheet
Syukri Yusoh
 
PPT
Lock Out / Tag Out
Bruce A. DelGrasso
 
PPT
Electrical safety
Prem kumar
 
PPT
SCAFFOLDING SAFETY.ppt
hamoudahedi
 
PDF
Industrial electrical symbols
Ayub Abd Rahman
 
PPTX
Training ppt on Chittaranjan Locomotive Works
Dhruv Upadhaya
 
Lockout tagout
Engr Jamali
 
Electrical Safety
Reliance
 
Industrial electrical safety
vtsiri
 
Overhead and gantry cranes safe operating procedures
ytcrane
 
Farana crane safety- B: Proactive magazine.pdf
CORE EHS
 
LOTO Training.ppt
Bimal Chandra Das
 
Working at heights
Chitra Mohanty
 
LOCKOUT-TAGOUT-SAFETY PRESENTATION-CONTROL OF HAZARDOUS ENERGY
jasonmorgan
 
Electrical safety slideshare
YokeshDhanabal
 
Undertake basic electrical tasks
catherinelindsay
 
Safety in Mechanical Industries
Verde Ventures Pvt. Ltd.
 
RAILWAY WORKSHOP TRANING PPT
Sahil arora
 
Inplant Training - Integral Coach Factory
Sudarshan Mohan
 
Electrical safety ppt
construction
 
material safety data sheet
Syukri Yusoh
 
Lock Out / Tag Out
Bruce A. DelGrasso
 
Electrical safety
Prem kumar
 
SCAFFOLDING SAFETY.ppt
hamoudahedi
 
Industrial electrical symbols
Ayub Abd Rahman
 
Training ppt on Chittaranjan Locomotive Works
Dhruv Upadhaya
 

Viewers also liked (20)

PPTX
A Fast Introduction to Arduino and Addressable LED Strips
atuline
 
PDF
Arduino Lecture 1 - Introducing the Arduino
Eoin Brazil
 
PPT
Intro to the arduino
ayreonmx
 
PDF
Blinky 101 with Arduino v1.0b3 (FastLED)
kriegsman
 
PPTX
Wood eze log splitters
Log Splitters World
 
PDF
Arduino nanomanual23
clickengenharia
 
PPTX
Arduino
LetzkuLetz Castro
 
PPTX
Arduino Microcontroller
Shyam Mohan
 
PPTX
Using arduino and raspberry pi for internet of things
Sudar Muthu
 
PPT
T 10 kaolin as high performance extender pigment for coatings - by s.v. kam...
Gn Tewari
 
PDF
Arduino based lpg gas monitoring &amp; automatic cylinder booking with alert ...
Shakas Technologies
 
PPTX
LPG gas leekage dectection
Abhishek Bhadoria
 
PPTX
Arduino / ArduBlock の簡単なプログラムと回路の例
mitunaga
 
PPTX
ブレッドボードの使い方と Arduino に簡単な回路をつける例
mitunaga
 
PPTX
Arduino 入門
mitunaga
 
PPTX
Introduction to Arduino Microcontroller
Mujahid Hussain
 
PPTX
Wireless gas leakage detector with device control
Reshma Gowri Chandran
 
PDF
Nanotechnology in building construction materials
GLAU, Mathura, UP, India
 
PPTX
nanotechnology in civil engineering
Sameer Charan
 
PPT
Arduino
vipin7vj
 
A Fast Introduction to Arduino and Addressable LED Strips
atuline
 
Arduino Lecture 1 - Introducing the Arduino
Eoin Brazil
 
Intro to the arduino
ayreonmx
 
Blinky 101 with Arduino v1.0b3 (FastLED)
kriegsman
 
Wood eze log splitters
Log Splitters World
 
Arduino nanomanual23
clickengenharia
 
Arduino Microcontroller
Shyam Mohan
 
Using arduino and raspberry pi for internet of things
Sudar Muthu
 
T 10 kaolin as high performance extender pigment for coatings - by s.v. kam...
Gn Tewari
 
Arduino based lpg gas monitoring &amp; automatic cylinder booking with alert ...
Shakas Technologies
 
LPG gas leekage dectection
Abhishek Bhadoria
 
Arduino / ArduBlock の簡単なプログラムと回路の例
mitunaga
 
ブレッドボードの使い方と Arduino に簡単な回路をつける例
mitunaga
 
Arduino 入門
mitunaga
 
Introduction to Arduino Microcontroller
Mujahid Hussain
 
Wireless gas leakage detector with device control
Reshma Gowri Chandran
 
Nanotechnology in building construction materials
GLAU, Mathura, UP, India
 
nanotechnology in civil engineering
Sameer Charan
 
Arduino
vipin7vj
 
Ad

Similar to Programming Addressable LED Strips (20)

PPTX
Arduino Workshop
atuline
 
PDF
publish manual
John Webster
 
PPTX
Electronz_Chapter_4.pptx
Mokete5
 
DOCX
Basic arduino sketch example
mraziff2009
 
PDF
Presentation S4A
Pedro González Romero
 
PDF
Iot 101
Anna Gerber
 
PDF
Presentation
Edson Silva
 
PPT
Physical prototyping lab2-analog_digital
Tony Olsson.
 
PPT
Physical prototyping lab2-analog_digital
Tony Olsson.
 
PPTX
Introduction to the Arduino
Wingston
 
PPTX
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Brian Huang
 
PDF
Arduino based applications part 1
Jawaher Abdulwahab Fadhil
 
PPTX
Arduino Slides With Neopixels
sdcharle
 
PPTX
Arduino Programming
Dr Karthikeyan Periasamy
 
PPTX
AAPT Presentation-No Videos.pptx
HimanshuJethwani
 
PPTX
Introduction to Arduino Webinar
Fragiskos Fourlas
 
PPTX
Arduino Robotics workshop Day1
Sudar Muthu
 
PPTX
Arduino slides
sdcharle
 
PPTX
Arduino Workshop Slides
mkarlin14
 
Arduino Workshop
atuline
 
publish manual
John Webster
 
Electronz_Chapter_4.pptx
Mokete5
 
Basic arduino sketch example
mraziff2009
 
Presentation S4A
Pedro González Romero
 
Iot 101
Anna Gerber
 
Presentation
Edson Silva
 
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Introduction to the Arduino
Wingston
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Brian Huang
 
Arduino based applications part 1
Jawaher Abdulwahab Fadhil
 
Arduino Slides With Neopixels
sdcharle
 
Arduino Programming
Dr Karthikeyan Periasamy
 
AAPT Presentation-No Videos.pptx
HimanshuJethwani
 
Introduction to Arduino Webinar
Fragiskos Fourlas
 
Arduino Robotics workshop Day1
Sudar Muthu
 
Arduino slides
sdcharle
 
Arduino Workshop Slides
mkarlin14
 
Ad

Recently uploaded (20)

PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Biography of Daniel Podor.pdf
Daniel Podor
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 

Programming Addressable LED Strips

  • 1. Having fun with an Arduino Nano & FastLED By: Andrew Tuline Programming Addressable LED Strips or
  • 2. Overview • Introductions • To program or not to program • Install IDE and check out drivers • Included examples • More examples • Some reference material • Create your own project Work on your own or with partners, and help each other out.
  • 3. This Workshop If you wish to program: • Assumes you’re familiar with .zip files, folders • Basic C++ programming • We’ll try several cool lighting examples Your Arduino is already programmed with an awesome demo, so you don’t NEED to re-program it.
  • 4. Installing Arduino Software • On Windows 7 • Installs to C:Program Files (x86)Arduino • Your programs are in C:UsersuseridDocumentsArduino • ‘Tools | Board’ should be changed to say ‘Arduino Nano w/ ATmega328’ • In Device Manager, see ‘Ports (COM & LPT)’ • Device drivers in C:Program Files (x86)ArduinodriversFTDI USB Drivers (we may be using another set of drivers) Are you running 32 bit or 64 bit?
  • 5. Touring the IDE • ‘File | Examples’ includes lots of examples • ‘File | Upload’ is how we compile and upload our program to the Arduino • ‘Help | Reference’ includes a local copy of the Language Reference Make GOOD use of those examples!
  • 6. Test the Drivers Declare constants & global variables One time setup of ports Continuous loop Test your drivers by compiling and uploading Blink.ino
  • 7. Arduino Nano Pins • Digital pins (input/output) • Analog pins (input/output) • Vin, Ground pins • 5V, 3.3V pins • Analog out is PWM • Most pins support other functions This project uses Vin, 5V, Ground and a few digital pins
  • 8. Addressable LED Strips • Traditionally, we assign output values to each R, G and B pin on each LED • This can use up a LOT of pins • Addressable LED strips provide circuitry to communicate serially
  • 9. LED Strip Connections D12 – D11 – 5V – Gnd – D6 – Vin – Data in Clock in 5V Gnd Button Battery + We’re using APA102 LED’s, aka DotStars
  • 10. What is FastLED? • FastLED is a fast, easy-to-use Arduino library for programming addressable LED strips. • FastLED is used by thousands of developers. • It’s FAST! Do a YouTube search for ‘FastLED’
  • 11. Downloading FastLED • The latest version is on GitHub at: https://github.com/FastLED/FastLED • Download the zip file. • Extract the directory FastLED-master. • Rename the directory from: FastLED-master to FastLED • Place that directory into: C:Program Files(x86)Arduinolibraries
  • 12. FirstLight Example • In the Arduino IDE, select ‘File | Examples | FastLED | FirstLight’ • We need to change the type of LED’s. • We need to change the data (and clock) pins. • We need to change the number of LED’s. • We then need to change the definition. We may need to change colour order!
  • 13. FirstLight Code #include "FastLED.h" #define NUM_LEDS 20 #define DATA_PIN 12 #define CLOCK_PIN 11 uint8_t max_bright = 64; CRGB leds[NUM_LEDS]; void setup() { FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, GRB>(leds, NUM_LEDS); FastLED.setBrightness(max_bright); } void loop() { for (int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed++) { leds[whiteLed] = CRGB::White; FastLED.show(); delay(100); leds[whiteLed] = CRGB::Black; } } The white LED should march across the array. Try red! // Include the library // Number of LED’s // Our data pin // Our clock pin // Define brightness limiter // Define the LED array // Run once // Initialize the LED array // Limit the brightness // Run continuously // Cycle through each LED in the array // Set the current one white // Show it // Wait for a bit // Set it to black
  • 14. Setting LED values • leds[9] = CRGB::Cyan; // Web colours • leds[9].g = 255; // Just set green • leds[0] = CRGB(255,0,0); // CRGB values (red, green, blue) • leds[0] = 0x0000ff; // Use a hex # OR • leds[9] = CSHV(hue, sat, bright); // Each goes up to 255 FastLED provides lots more ways to assign colours to LED’s
  • 15. Variable Types Variable types include: – int (-32768 to 32767 is 16 bit signed) – uint (0 to 65535 is 16 bit unsigned) – uint8_t (0 to 255 is 8 bit unsigned) – long (is 32 bits signed) – and many more. . . Variable scope can also be important as well
  • 16. Random Numbers long num = random(); // 32 bit uint8_t unum = random8(); // 8 bit int inum = random16(0, 1023); // 16 bit • The ‘long’ can be used to assign random RGB colours • The ‘uint8_t’ can be used to assign hue, brightness values • It can also refer to LED elements in your strip random8() and random16() are FastLED functions
  • 17. If Statements This example occasionally flashes a random colour on a random LED. void loop() { uint8_t j = random16(0, 100); // Which LED will we light up if ( j < NUM_LEDS ) { // Only display if that number IS in our array leds[j] = random(); // 32 bit randomizer for colour FastLED.show(); delay(100); leds[j] = CRGB::Black; // Make that LED black again } }
  • 18. For Loops This example sets each LED a different colour, waits 2 seconds and repeats. void loop() { for (int i = 0; i < NUM_LEDS; i++) { // Last element is leds[NUM_LEDS-1] leds[i] = random(); // A 32 bit random number } FastLED.show(); delay(2000); }
  • 19. We’re Just Getting Started FastLED contains a LOT of functions including: • Random number generation • Fast 8 and 16 bit basic math functions • Fast trigonometry • Setting RGB and HSV values • fill_rainbow, fill_gradient, fading, scaling, blending, noise, palettes • Power management We’re talking FAST
  • 20. Rainbow March #include "FastLED.h" #define LED_DT 12 // Data pin #define LED_CK 11 // Clock pin #define NUM_LEDS 20 // Number of LED's #define COLOR_ORDER GRB // Change the order as necessary #define LED_TYPE APA102 // What kind of strip are you using? uint8_t max_bright = 64; // How bright do we want to go struct CRGB leds[NUM_LEDS]; // Initialize our array uint8_t thisdelay = 8; // A delay value for the sequence uint8_t thishue; // Starting hue value. uint8_t deltahue = 5; // Difference in hue between LED’s Use variables where possible
  • 21. Rainbow March cont’d void setup() { LEDS.addLeds<LED_TYPE, LED_DT, LED_CK, COLOR_ORDER>(leds, NUM_LEDS); FastLED.setBrightness(max_bright); } void loop () { rainbow_march(); FastLED.show(); delay(thisdelay); } void rainbow_march() { thishue++; fill_rainbow (leds, NUM_LEDS, thishue, deltahue); // FastLED does the heavy lifting }
  • 22. More FastLED Demos • There’s also several 3rd party demos at: https://github.com/atuline/FastLED-Demos • Unzip and store them in: C:users<username>DocumentsArduino
  • 23. Try More Demo’s • Try one_sine • Try one_sine demo • Try pop_fade_demo • Try ripple • Try two_sin_demo • Try noise16_demo • Try three_sin_demo • Try rainbow_march_demo Don’t forget the FastLED examples
  • 24. Google for more FastLED
  • 25. Arduino Research • www.fastled.io • github.com • arduino.cc/tutorial • playground.arduino.cc • tronixstuff.com/tutorials • learn.sparkfun.com/tutorials • oomlout.com/a/products/ardx Don’t forget the examples included with the Arduino software
  • 26. Inspirational Web Sites • www.instructables.com • www.tindie.com • www.makershed.com • www.makezine.com
  • 27. Sources for Parts • www.robotshop.ca • www.sparkfun.com • www.leeselectronics.com • www.gravitech.us • www.adafruit.com • www.ebay.ca • www.aliexpress.com • www.amazon.com • www.dealextreme.com All it takes is a VISA card and your imagination
  • 28. Local Events • North Delta Luminary Festival • Vancouver Mini Maker Faire • WestSurDel Fun Night • Vancouver Bike Rave • Christmas events • Any night market Then there’s Burning Man

Editor's Notes

  • #2: I want to do that and more and I’m going to use the highly popular Arduino Microcontroller.
  • #5: Let’s go through some menu items.