Beruflich Dokumente
Kultur Dokumente
(https://www.youtube.com/c/ELECTRONOOBS)
(https://www.instagram.com/ELECTRONOOBS)
(https://www.facebook.com/Electronoobs)
(https://twitter.com/ELECTRONOOBS) ADVERTISERS
Daft Punk
helmet
CODE
H… Help me by sharing this post
Share 31
This is the code used with my Daft Punk helmet project. Make sure the BT mdoule is
not connected to the Tx and Rx pins and then compile and upload the code. you will
also need some libraries that you cold find below. Download those and install them
before you compile the code.
(http://bit.ly/2JAAfV
Included
TCR The Club of Riverdale $ 537.000 $ 119
(eng_arduino_tut62_2.php)
/* Daft punk helmet code with Bluetooth control and microphone
* Tutorial webpage: https://www.electronoobs.com/eng_arduino_tut62.php
* Schematic: https://www.electronoobs.com/eng_arduino_tut62_sch1.php
* Part list: https://www.electronoobs.com/eng_arduino_tut62_parts1.php
*/
//////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////EDITABLE VARIABLES///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
#define PIN 9 //Select here the digital pin used for the LED strip data pin
#define NUMPIXELS 105 //Amount of LEDs. I have 7 row of 15 LEDs wit a total of 105 LEDs
String text = "ELECTRONOOBS SUBSCRIBE"; //Put here the default text to be printed on the
LED matrix when it's powered on
int Delay = 5000; //Delay for the eye movement
int brightness = 10; //Defaulst brightness
int min_adc = 690; //min range of the microphone ADC read
int max_adc = 840; //max range of the microphone ADC read
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
/* * I defien 2 matrices because I've used two different code exampels to create my scroll text, eyes, e
tc..
That's why below I define a NeoPixel matrix and a simple matrix controlled LED by LED, one by one.
matrix 1 is "pixels" and matrix 2 is called "matrix"
*/
//More variables
int string_length = 0;
static byte byteRead=0;
bool print_text = true;
bool print_eyes= false;
bool print_rainbow = false;
bool print_side_to_side = false;
bool print_spectrum = false;
bool print_Chase = false;
bool print_off = false;
unsigned long previousMillis = 0;
//////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////ADC config//////////////////////////////////////////////////
//ADC sampling variables
int adc_in = A0;
int adc = 0;
#define ADC_MULTISAMPLING 2
#define ADC_MULTISAMPLING_SAMPLES (1 << ADC_MULTISAMPLING)
//////////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
pinMode(adc_in,INPUT);
Serial.begin(9600); //Start the serial communication for the BT module
pixels.begin(); // This initializes the NeoPixel library. //Start the LED matrix 2
}
int x = matrix.width();
int pass = 0;
void loop()
{
if(Serial.available()>0)
{
byteRead = Serial.read(); //Read data from the BT module
if(byteRead=='T') //If we receive a "T", then we gen into text scroll mode
{
text = Serial.readString(); //Store the bluetooth received text
print_text = true;
print_eyes= false;
print_rainbow = false;
print_side_to_side = false;
print_spectrum = false;
print_Chase = false;
print_off = false;
}
if(byteRead=='E') //If we receive a "E", then we gen into eyes mode
{
print_eyes= true;
print_text = false;
print_rainbow = false;
print_side_to_side = false;
print_spectrum = false;
print_Chase = false;
print_off = false;
}
if(byteRead=='B') //If we receive a "V", then we change brightness to the received val
ue
{
String Received = Serial.readString();
int brightness = (int(Received[0])-48)*10;
if(brightness == 0)
{
brightness = 100;
}
brightness = constrain(brightness,0,100);
matrix.setBrightness(brightness);
pixels.setBrightness(brightness);
Serial.println(brightness);
} Alfawise U30
if(byteRead=='O') //If we receive a "O", then we turn off the LEDs 2.8 inch Touch
{ Screen DIY
print_eyes= false;
print_text = false; Desktop 3D
print_rainbow = false;
Printer - U30
print_side_to_side = false;
print_spectrum = false; EU Plug Black
print_Chase = false;
print_off = true;
only $$162.89
} (https://www.gearbe
if(byteRead=='R') //If we receive a "R", then we get into rainbow mode printers-3d-
{ printer-
print_eyes= false;
print_text = false; kits/pp_009954647
print_rainbow = true; lkid=39527337)
print_side_to_side = false;
print_spectrum = false;
print_Chase = false;
print_off = false;
}
pixels.setPixelColor(33+y, pixels.Color(255,0,0));
pixels.setPixelColor(34+y, pixels.Color(255,0,0));
pixels.setPixelColor(40+y, pixels.Color(255,0,0));
pixels.setPixelColor(41+y, pixels.Color(255,0,0));
pixels.setPixelColor(47-y, pixels.Color(255,0,0));
pixels.setPixelColor(48-y, pixels.Color(255,255,255));
pixels.setPixelColor(49-y, pixels.Color(255,255,255));
pixels.setPixelColor(50-y, pixels.Color(255,0,0));
pixels.setPixelColor(54-y, pixels.Color(255,0,0));
pixels.setPixelColor(55-y, pixels.Color(255,255,255));
pixels.setPixelColor(56-y, pixels.Color(255,255,255));
pixels.setPixelColor(57-y, pixels.Color(255,0,0));
pixels.setPixelColor(63+y, pixels.Color(255,0,0));
pixels.setPixelColor(64+y, pixels.Color(255,0,0));
pixels.setPixelColor(70+y, pixels.Color(255,0,0));
pixels.setPixelColor(71+y, pixels.Color(255,0,0));
pixels.setPixelColor(33+y, pixels.Color(255,0,0));
pixels.setPixelColor(34+y, pixels.Color(255,0,0));
pixels.setPixelColor(40+y, pixels.Color(255,0,0));
pixels.setPixelColor(41+y, pixels.Color(255,0,0));
pixels.setPixelColor(47-y, pixels.Color(255,0,0));
pixels.setPixelColor(48-y, pixels.Color(255,255,255));
pixels.setPixelColor(49-y, pixels.Color(255,255,255));
pixels.setPixelColor(50-y, pixels.Color(255,0,0));
pixels.setPixelColor(54-y, pixels.Color(255,0,0));
pixels.setPixelColor(55-y, pixels.Color(255,255,255));
pixels.setPixelColor(56-y, pixels.Color(255,255,255));
pixels.setPixelColor(57-y, pixels.Color(255,0,0));
pixels.setPixelColor(63+y, pixels.Color(255,0,0));
pixels.setPixelColor(64+y, pixels.Color(255,0,0));
pixels.setPixelColor(70+y, pixels.Color(255,0,0));
pixels.setPixelColor(71+y, pixels.Color(255,0,0));
y = -2 ;
}//end of current millis
}//end of print eyes
i = 14;
delay(100);
while(i >= 0)
{
pixels.setPixelColor(58-i, pixels.Color(0,0,0));
pixels.setPixelColor(59-i, pixels.Color(255,255,255));
pixels.show(); // This sends the updated pixel color to the hardware.
delay(Delay_time);
i = i - 1;
}
i = 0;
delay(100);
if(level==2)
{
int r = 0;
while (r < 105)
{
pixels.setPixelColor(r, pixels.Color(0,0,0)); Creality 3D
r = r + 1; Ender-3 V-slot
}
r=0; Prusa I3 DIY
while (r < 15) 3D Printer Kit
{
pixels.setPixelColor(r, pixels.Color(0,255,0)); 220 x 220 x
r = r + 1;
250mm
}
Printing Size -
while (r < 30)
{
EU Plug Black
pixels.setPixelColor(r, pixels.Color(150,255,0)); only $$153.84
r = r + 1;
} (https://www.gearbe
r=0; printers-3d-
pixels.show(); // This sends the updated pixel color to the hardware.
}//end of level 2 printer-
kits/pp_1845899.ht
if(level==3) lkid=39527206)
{
int r = 0;
while (r < 105)
{
pixels.setPixelColor(r, pixels.Color(0,0,0));
r = r + 1;
}
r=0;
while (r < 15)
{ Alfawise U20
pixels.setPixelColor(r, pixels.Color(0,255,0));
r = r + 1; Large Scale
}
2.8 inch Touch
while (r < 30) Screen DIY
{
pixels.setPixelColor(r, pixels.Color(150,255,0));
3D Printer -
r = r + 1; EU - U20 EU
}
Plug Black
while (r < 45) only $$253.39
{
pixels.setPixelColor(r, pixels.Color(255,255,0)); (https://www.gearbe
r = r + 1; printers-3d-
}
r=0; printer-
pixels.show(); // This sends the updated pixel color to the hardware.
kits/pp_1841229.ht
}//end of level 3
lkid=39527285)
if(level==4)
{
int r = 0;
while (r < 105)
{
pixels.setPixelColor(r, pixels.Color(0,0,0));
r = r + 1;
}
r=0;
while (r < 15)
{
pixels.setPixelColor(r, pixels.Color(0,255,0));
r = r + 1;
}
diagram.js
while (r < 45) Ad mindfusion.eu
{ Adafruit…
pixels.setPixelColor(r, pixels.Color(255,255,0)); electronoobs.com
r = r + 1;
Best…
}
Ad NAGI HAIR
PWM receiver…
r=0;
electronoobs.com
pixels.show(); // This sends the updated pixel color to the hardware.
}//end of level 4 Analog POV…
electronoobs.com
How to make…
if(level==5) electronoobs.com
{ LCD special…
int r = 0; electronoobs.com
while (r < 105)
i2c 16x2 LCD…
{
electronoobs.com
pixels.setPixelColor(r, pixels.Color(0,0,0));
r = r + 1; 16x2 LCD…
electronoobs.com
}
r=0;
while (r < 15)
{
pixels.setPixelColor(r, pixels.Color(0,255,0));
r = r + 1;
}
r=0;
pixels.show(); // This sends the updated pixel color to the hardware.
}//end of level 5
if(level==6)
{
int r = 0;
while (r < 105)
{
pixels.setPixelColor(r, pixels.Color(0,0,0));
r = r + 1;
}
r=0;
while (r < 15)
{
pixels.setPixelColor(r, pixels.Color(0,255,0));
r = r + 1;
}
r=0;
pixels.show(); // This sends the updated pixel color to the hardware.
}//end of level 6
if(level==7)
{
int r = 0;
while (r < 105)
{
pixels.setPixelColor(r, pixels.Color(0,0,0));
r = r + 1;
}
r=0;
while (r < 15)
{
pixels.setPixelColor(r, pixels.Color(0,255,0));
r = r + 1;
}
r=0;
pixels.show(); // This sends the updated pixel color to the hardware.
}//end of level 7
}//end of print spectrum
if(print_off)
{
int r = 0;
while (r < 105)
{
pixels.setPixelColor(r, pixels.Color(0,0,0));
r = r + 1;
}
pixels.show();
r=0;
}
float read_adc()
{
// Filter the ADC by multisampling with the values defined at the beginning
adc = 0;
for (int i = 0; i < ADC_MULTISAMPLING_SAMPLES; ++i)
adc += analogRead(adc_in);
adc = adc >> ADC_MULTISAMPLING;
return(adc);
}
delay(wait);
Add a comment...
Dario Martin
Hola...
consulta:
por qué si todo, según tengo entendido, funciona con 5V usas una LiPo de 11.1V?
En Argentina me costo consegir la tira de leds y no quiero quemarlos...
gracias...
Like · Reply · 29w
(eng_arduino_tut62_2.php)
ELECTRONOOBS 2019
Keep up you guys!