Project tutorial

Blinky Tune Badge © CC BY-NC

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

  • 597 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

Submitted to Contest

Build the snappiest add-on, to make a lonely badge a happy badge to win one of our newest t-shirts.

BadgeLove!

Author

Inductor color code   copy
Shahariar
  • 17 projects
  • 123 followers

Published on

March 15, 2019

Members who respect this project

Inductor color code   copy1012043AdambenzFabio souza

and 3 others

See similar projects
you might like

Similar projects you might like

LED Matrix Display Badge

Project tutorial by Team FabLabAQ

  • 2,440 views
  • 3 comments
  • 14 respects

Smart Poetic OLED Display Badge

Project tutorial by Ashwini kumar sinha

  • 1,159 views
  • 2 comments
  • 10 respects

Blinky Bacon Blackboard - LED Art Light

Project in progress by ArduBacon

  • 561 views
  • 0 comments
  • 4 respects

Dead Bug Valentine

Project tutorial by wrightmac

  • 2,686 views
  • 1 comment
  • 17 respects

RFID Badge Scanner with LCD

by Josh From BreakoutBros.com

  • 14,684 views
  • 4 comments
  • 36 respects

Multi-Source Controlled USB Lamp

Project tutorial by Amal Mathew

  • 3,653 views
  • 2 comments
  • 20 respects
Add projectSign up / Login