photo logo fab lab puebla_zpsf84vuacy.jpg
 photo fab-academy2_zpszvqovjt6.jpg
 photo fab-academy2_zpszvqovjt6.jpg

Huber Girón Nieto

Electronic and Mechatronic Engineer

Contact

e-mail: huber.giron.nieto@iberopuebla.mx

phone: +52 (222) 372 3000 ext.12917

FABLAB Puebla Researcher

WEEK ASSIGNMENT:

Output devices

Add an output device to a micro-controller board you've designed and program it to do something

 

 

 

 

 

 

For this week activity we need to add a output to a micro-controller board.

We use some digital serial LED's : WS2811

 photo 2015-05-05 224315_zpsega0nktd.jpg

Device connections

We use the attiny44A micro-controller Board made in activity six, based in Fab Academy Hello-World board:

 

 

 

 

 

 

 

 photo hello_ftdi_44_zpsascwdakw.jpg
 photo 20150307_210149_zpscpdlxw7a.jpg

To connect the WS2811 serial LED's, we use the Ground, 5V an Data Pin.

 

 

 

 

 

 

 

 photo 2015-05-05 230403_zpsf7uuifqu.jpg
 photo 2015-05-05 224339_zpsnall7vsr.jpg
 photo 2015-05-05 224520_zpswgxa8izu.jpg

Color Test

 

Using the Fast_Led Library you can change the color of each single LED using a RGB color code or using the precharged color names:

 

 

 

 

 

 

 

 photo clor1_zpsgxvxfed7.jpg
 photo clor2_zpslatlbntr.jpg

Code:

#include "FastLED.h"

#define NUM_LEDS 22

#define DATA_PIN 0

CRGB leds[NUM_LEDS];

int x=20;

 

void setup() {

    pinMode(DATA_PIN, OUTPUT);

  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);

}

void loop() {

leds[0] = CRGB::Black;

leds[1] = CRGB::Red;

leds[2] = CRGB::Blue;

leds[3] = CRGB::Green;

leds[4] = CRGB::Purple;

leds[5] = CRGB::Yellow;

leds[6] = CRGB::Cyan;

leds[7] = CRGB::Coral;

leds[8] = CRGB::DarkBlue;

leds[9] = CRGB::Orange;

leds[10] = CRGB::Pink;

leds[11] = CRGB::Gold;

leds[12] = CRGB::FloralWhite;

leds[13] = CRGB::Sienna;

leds[14] = CRGB::Maroon;

leds[15] = CRGB::MediumOrchid;

                leds[16].r = 0;

                leds[16].g = 0;

                leds[16].b = 255;

 

                leds[17].r = 0;

                leds[17].g = 255;

                leds[17].b = 0;

 

                leds[18].r = 255;

                leds[18].g = 0;

                leds[18].b = 0;

 

                leds[19].r = 255;

                leds[19].g = 255;

                leds[19].b = 0;

 

                leds[20].r = 255;

                leds[20].g = 0;

                leds[20].b = 255;

 

                leds[21].r = 0;

                leds[21].g = 255;

                leds[21].b = 255;

 

FastLED.show();

}

 

 

 

 photo 2015-05-05 224952_zps03zkzihc.jpg
 photo 2015-05-04 142504_zpsyoth93ah.jpg
 photo 2015-05-05 225003_zpsd8af6nqy.jpg
 photo 2015-05-05 225010_zpszgganmev.jpg
 photo 2015-05-05 225023_zpsvorzkoqh.jpg
 photo 2015-05-05 225049_zpsumfdicrc.jpg
 photo 2015-05-05 225820_zps0w2xwpzu.jpg
 photo 2015-05-05 225818_zpsmrjwftyg.jpg
 photo 2015-05-05 225823_zpsk8qgn8ic.jpg
 photo 2015-05-05 224315_zpsega0nktd.jpg

Change color Test

Code:

#include "FastLED.h"

 

#define NUM_LEDS 19

#define DATA_PIN 0

CRGB leds[NUM_LEDS];

 

void setup() {

    pinMode(DATA_PIN, OUTPUT);

  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);

 

}

 

void loop() {

for(int i = 0; i < NUM_LEDS; i++) {

leds[i] = CRGB::Blue;}

FastLED.show();

delay(500);

 

for(int i = 0; i < NUM_LEDS; i++) {

leds[i] = CRGB::Green;}

FastLED.show();

delay(500);

 

for(int i = 0; i < NUM_LEDS; i++) {

leds[i] = CRGB::Purple;}

FastLED.show();

delay(500);

 

for(int i = 0; i < NUM_LEDS; i++) {

leds[i] = CRGB::Red;}

FastLED.show();

delay(500);

}

 

 

 

 

Change serial color Test

Code:

#include "FastLED.h"

 

#define NUM_LEDS 15

#define DATA_PIN 0

CRGB leds[NUM_LEDS];

int x=80;

 

void setup() {

    pinMode(DATA_PIN, OUTPUT);

  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);

 

}

 

void loop() {

 

 for(int i = 0; i < NUM_LEDS; i++) {

  leds[i] = CRGB::Red;

  FastLED.show();

  delay(x);

 }

 

 for(int i = 0; i < NUM_LEDS; i++) {

  leds[i] = CRGB::Blue;

  FastLED.show();

  delay(x);

 }

 

 for(int i = 0; i < NUM_LEDS; i++) {

  leds[i] = CRGB::Green;

  FastLED.show();

  delay(x);

 }

 

 for(int i = 0; i < NUM_LEDS; i++) {

  leds[i] = CRGB::Purple;

  FastLED.show();

  delay(x);

 }

 

 

 for(int i = 0; i < NUM_LEDS; i++) {

  leds[i] = CRGB::Yellow;

  FastLED.show();

  delay(x);

 }

 

 for(int i = 0; i < NUM_LEDS; i++) {

  leds[i] = CRGB::White;

  FastLED.show();

  delay(x);

 }

}