Produktinformationen "MakerTeam - Smart RGB Cube Bausatz"
Smart RGB Cube Bausatz
Lieferumfang:
- 05x Smart RGB Matrix Platine 30x30mm mit 9x WS2812B LEDs
- 10x Blechschraube Torx 2,2 x 9,5mm
- 10x Drahtbrücke 0.6mm
- 01x 3D Base (PLA Galaxy Black)
- 01x 3D Holder (PLA schwarz)
- 03x 100cm Kabel 0,25mm² (je 1x schwarz, grün, rot)
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6
#define LEDAMOUNT 45
#define CUBES 5
Adafruit_NeoPixel strip = Adafruit_NeoPixel(LEDAMOUNT, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
strip.begin();
strip.setBrightness(255);
strip.show();
}
void loop() {
int delaytime = 40;
uint32_t color = strip.Color(random(255), random(255), random(255));
uint32_t off = strip.Color(0, 0, 0);
ring1(color);
strip.show();
delay(delaytime);
ring2(color);
strip.show();
delay(delaytime);
ring3(color);
strip.show();
delay(delaytime);
cubeInOneColor(color, 2);
delay(delaytime);
cubeInOneColor(off, 2);
delay(delaytime);
ring3(off);
strip.show();
delay(delaytime);
ring2(off);
strip.show();
delay(delaytime);
ring1(off);
strip.show();
delay(delaytime);
ring1(color);
strip.show();
delay(delaytime);
ring2(color);
strip.show();
delay(delaytime);
ring3(color);
strip.show();
delay(delaytime);
cubeInOneColor(color, 2);
delay(delaytime);
ring1(off);
strip.show();
delay(delaytime);
ring2(off);
strip.show();
delay(delaytime);
ring3(off);
strip.show();
delay(delaytime);
cubeInOneColor(off, 2);
delay(delaytime);
lineFade(255,255,255);
lineFade(255,255,0);
lineFade(255,0,0);
lineFade(255,0,255);
lineFade(0,0,255);
lineFade(0,255,0);
}
void lineFade(int r, int g, int b)
{
int row1[12] = {0,1,2, 35,34,33, 26,25,24, 44,43,42};
int row2[12] = {3,4,5, 32,31,30, 23,22,21, 41,40,39};
int row3[12] = {6,7,8, 29,28,27, 20,19,18, 38,37,36};
for(int i=0; i<12; i++){
strip.clear();
strip.setPixelColor(row1[i], strip.Color(r, g, b));
strip.setPixelColor(row2[i], strip.Color(r, g, b));
strip.setPixelColor(row3[i], strip.Color(r, g, b));
strip.show();
delay(30);
}
}
void ring1(uint32_t color){
strip.setPixelColor(0, color);
strip.setPixelColor(1, color);
strip.setPixelColor(2, color);
strip.setPixelColor(24, color);
strip.setPixelColor(25, color);
strip.setPixelColor(26, color);
strip.setPixelColor(33, color);
strip.setPixelColor(34, color);
strip.setPixelColor(35, color);
strip.setPixelColor(42, color);
strip.setPixelColor(43, color);
strip.setPixelColor(44, color);
}
void ring2(uint32_t color){
strip.setPixelColor(3, color);
strip.setPixelColor(4, color);
strip.setPixelColor(5, color);
strip.setPixelColor(21, color);
strip.setPixelColor(22, color);
strip.setPixelColor(23, color);
strip.setPixelColor(30, color);
strip.setPixelColor(31, color);
strip.setPixelColor(32, color);
strip.setPixelColor(39, color);
strip.setPixelColor(40, color);
strip.setPixelColor(41, color);
}
void ring3(uint32_t color){
strip.setPixelColor(6, color);
strip.setPixelColor(7, color);
strip.setPixelColor(8, color);
strip.setPixelColor(18, color);
strip.setPixelColor(19, color);
strip.setPixelColor(20, color);
strip.setPixelColor(27, color);
strip.setPixelColor(28, color);
strip.setPixelColor(29, color);
strip.setPixelColor(36, color);
strip.setPixelColor(37, color);
strip.setPixelColor(38, color);
}
/*
* For Random Flashlight
*/
void randomFlash(){
strip.clear();
strip.setPixelColor(random(LEDAMOUNT), strip.Color(255, 255, 255));
strip.show();
delay(10);
}
void cubeInOneColor(uint32_t color, int cubeNo) {
for (int i = 0; i < 9; i++) {
strip.setPixelColor(i + cubeNo * 9 - 9, color);
}
strip.show();
}
void cubeRadialColor(uint32_t color, int cubeNo, int delayTime) {
strip.setPixelColor(0 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(1 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(2 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(5 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(8 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(7 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(6 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(3 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
strip.setPixelColor(4 + cubeNo * 9 - 9 , color);
strip.show();
delay(delayTime);
}
Anmelden