Project tutorial

Blinky Tune Badge © CC BY-NC

A badge to flash LED and play tone with adjustable tempo/blink rate.

  • 876 views
  • 0 comments
  • 7 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Blinky tune badge

  • A badge with 8 LEDs and a buzzer
  • LED effect and beep music
  • Adjustable speed with 2 push switches
  • Rechargeable LiPo
  • SPI programming
  • Usable for simple analog sensing projects

Code

main.cArduino
//  notes kiit 
//  F#4 G4 F#4  C#5  F#5 G5 F#5  C#5  F#4 G4 F#4 C#5  F#5 E5 (pause)
//  F#4 G4 F#4  C#5  F#5 G5 F#5  C#5  F#4 G4 F#4 C#5  F#5 G5  E5 F#5
//  http://pages.mtu.edu/~suits/notefreqs.html
#define note_Ch5 555
#define note_E5  660
#define note_Fh4 370
#define note_Fh5 740
#define note_G4  392
#define note_G5  784




int delay_val=10;
int tone_pin = 4;


void setup() {
  // initialize digital pin 13 as an output.
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  
   pinMode(2, INPUT_PULLUP);
   pinMode(3, INPUT_PULLUP); 
   attachInterrupt(0, dec_delay,FALLING);
   attachInterrupt(1, inc_delay,FALLING);
 
  
}

// the loop function runs over and over again forever
void loop()
{

//  F#4 G4 F#4  C#5  F#5 G5 F#5  C#5  F#4 G4 F#4 C#5  F#5 E5 (pause)
//  F#4 G4 F#4  C#5  F#5 G5 F#5  C#5  F#4 G4 F#4 C#5  F#5 G5  E5 F#5



kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_G4, 150);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_Ch5, 150);
kr_blink();  tone(tone_pin, note_Fh5, 150);
kr_blink();  tone(tone_pin, note_G5, 150);
kr_blink();  tone(tone_pin, note_Fh5, 150);
kr_blink();  tone(tone_pin, note_Ch5, 150);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_G4, 150);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_Ch5, 150);
kr_blink();  tone(tone_pin, note_Fh5, 150);
kr_blink();  tone(tone_pin, note_E5, 150);
delay(300);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_G4, 150);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_Ch5, 150);
kr_blink();  tone(tone_pin, note_Fh5, 150);
kr_blink();  tone(tone_pin, note_G5, 150);
kr_blink();  tone(tone_pin, note_Fh5, 150);
kr_blink();  tone(tone_pin, note_Ch5, 150);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_G4, 150);
kr_blink();  tone(tone_pin, note_Fh4, 150);
kr_blink();  tone(tone_pin, note_G5, 150);
kr_blink();  tone(tone_pin, note_E5, 150);
kr_blink();  tone(tone_pin, note_Fh5, 150);
 
 
}

void inc_delay()
{
  delay_val=delay_val+2;
}

void dec_delay()
{
  if(delay_val>3)
  delay_val=delay_val-2;
}

void kr_blink(void)
{
   digitalWrite(6, HIGH);   
  delay(delay_val);           
  digitalWrite(6, LOW);    
  delay(delay_val);             
  digitalWrite(7, HIGH);   
  delay(delay_val);           
  digitalWrite(7, LOW);    
  delay(delay_val);             
  digitalWrite(8, HIGH);   
  delay(delay_val);           
  digitalWrite(8, LOW);    
  delay(delay_val);             
  digitalWrite(5, HIGH);   
  delay(delay_val);           
  digitalWrite(5, LOW);    
  delay(delay_val);             
  digitalWrite(9, HIGH);   
  delay(delay_val);           
  digitalWrite(9, LOW);    
  delay(delay_val);             
  digitalWrite(10, HIGH);   
  delay(delay_val);           
  digitalWrite(10, LOW);    
  delay(delay_val);             
  digitalWrite(11, HIGH);   
  delay(delay_val);           
  digitalWrite(11, LOW);    
  delay(delay_val);             
  digitalWrite(12, HIGH);   
  delay(delay_val);           
  digitalWrite(12, LOW);    
  delay(delay_val);             
  digitalWrite(11, HIGH);   
  delay(delay_val);           
  digitalWrite(11, LOW);    
  delay(delay_val);             
  digitalWrite(10, HIGH);   
  delay(delay_val);           
  digitalWrite(10, LOW);    
  delay(delay_val);             
  digitalWrite(9, HIGH);   
  delay(delay_val);           
  digitalWrite(9, LOW);    
  delay(delay_val);             
  digitalWrite(5, HIGH);   
  delay(delay_val);           
  digitalWrite(5, LOW);    
  delay(delay_val);             
  digitalWrite(8, HIGH);   
  delay(delay_val);           
  digitalWrite(8, LOW);    
  delay(delay_val);             
  digitalWrite(7, HIGH);   
  delay(delay_val);           
  digitalWrite(7, LOW);    
  delay(delay_val);
}

Schematics

Arduino Equiv
Videotogif 2019 02 17 22 24 33 gxysj2ukol
actual sch
Original
Videotogif 2019 02 17 22 26 00 pwh0vjmyq3

Comments

Similar projects you might like

LED Matrix Display Badge

Project tutorial by Team FabLabAQ

  • 3,465 views
  • 3 comments
  • 19 respects

The Hackster Badge

Project tutorial by Michael Darby - 314Reactor

  • 879 views
  • 1 comment
  • 7 respects

Smart Poetic OLED Display Badge

Project tutorial by Ashwini kumar sinha

  • 1,886 views
  • 2 comments
  • 16 respects

Arduino LIXIE Clock

Project tutorial by MEGA DAS

  • 3,905 views
  • 0 comments
  • 16 respects

Blinky Bacon Blackboard - LED Art Light

Project in progress by Team ArduBacon

  • 664 views
  • 0 comments
  • 4 respects

Gesture Drive: Accelerate with Freedom

Project tutorial by Shahariar

  • 3,395 views
  • 0 comments
  • 12 respects
Add projectSign up / Login