Camiseta Electrónica
Camiseta Electrónica
Este proyecto surgió porque queríamos hacer en Electrónica de Luis un escaparate bastante llamativo.
Material usado:
x2 arduino Nano
x1 matriz flexible de neopixeles
x1 matriz de 8*8
x1 alimentador 5V 2A
x1 camiseta
y a nuestro amigo de pruebas Maniqui_1.
En este caso utilice dos arduinos nano, uno para cada matriz.

Código Matriz mensaje:
/*
Example "Protest scroller" for 8x32 WS2812 "NeoPixel Display
Assumes you are running a standard Arduino ATMega328 compatible board
*/
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
// DATA PIN
// If you want to use a different data pin on your microcontroller CHANGE THIS!
#define DATA_PIN 2
#define arr_len( x ) ( sizeof( x ) / sizeof( *x ) )
// Matrix setup params
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, DATA_PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
// Edit this
// The important stuff, your message and colors
char* slogans[]= {"ELECTRONICA DE LUIS","9:00 - 14:00","16:00 - 21:00",":) SABADOS 9:30-14:00 :)"};
const uint16_t colors[] = { matrix.Color(255, 0, 100), matrix.Color(0, 128, 128), matrix.Color(0, 200, 128),matrix.Color(128, 0, 128) };
int brightness = 100;
// End Edit
int numMode = arr_len(slogans)-1;
int numColor = arr_len(colors)-1;
int pixelPerChar = 6;
int maxDisplacement;
int mode = 0;
void setup() {
matrix.begin();
matrix.setTextWrap(false);
matrix.setBrightness(brightness);
matrix.setTextColor(colors[0]);
}
int y = matrix.height();
int x = matrix.width();
int pass = 0;
int line_pass = 0;
void loop() {
// if mode greater than numMode reset
if (mode > numMode) { mode = 0; }
matrix.fillScreen(0);
matrix.setCursor(x, 0);
scroll(slogans[mode],20);
}
// this does the magic of scrolling
void scroll(char* message,int delays) {
maxDisplacement = strlen(message) * pixelPerChar + matrix.width();
if(++line_pass > matrix.width()) line_pass = 0;
matrix.print(String(message));
if(--x < -maxDisplacement) {
x = matrix.width();
if(++pass >= numColor) { pass = 0; };
matrix.setTextColor(colors[pass]);
mode++;
}
matrix.show();
delay(delays);
}
Código corazón latidos:
//https://github.com/FastLED/FastLED/wiki/Basic-usage
//http://www.playbyte.es/electronica/arduino/tira-led-neopixel-ws2812b/ efecto del latido
#include <FastLED.h>
#define NUM_LEDS 64
#define DATA_PIN 3 //PWM
#define BRIGHTNESS 5
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); FastLED.setBrightness( BRIGHTNESS );
}
void loop() {
corazon();
latido();
}
//efecto corazon
void corazon(){
leds[1] = CRGB::Red; leds[2] = CRGB::Red; leds[5] = CRGB::Red; leds[6] = CRGB::Red;
for(int i = 8; i <= 31; i++){
leds[i] = CRGB::Red;
}
for(int i = 33; i <= 38; i++){
leds[i] = CRGB::Red;
}
for(int i = 42; i <= 45; i++){
leds[i] = CRGB::Red;
}
for(int i = 51; i <= 52; i++){
leds[i] = CRGB::Red;
}
FastLED.show();
}
//Brillo intensidad
void latido() {
for(int brillo = 0; brillo <=255 ; brillo=brillo+2) {
FastLED.setBrightness(brillo);
delay(5);
FastLED.show();
}
for(int brillo = 255; brillo >=0 ; brillo=brillo-2) {
FastLED.setBrightness(brillo);
delay(5);
FastLED.show();
}
for(int brillo = 0; brillo <=255 ; brillo=brillo+2) {
FastLED.setBrightness(brillo);
delay(2);
FastLED.show();
}
for(int brillo = 255; brillo >=0 ; brillo=brillo-2) {
FastLED.setBrightness(brillo);
delay(2);
FastLED.show();
}
}





Comentarios
Publicar un comentario