#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "pitches.h" // Include the pitches library

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Define the buzzer pin
int buzzer = 13;

// Nokia Tune Melody
int melody[] = {
  NOTE_E5, 8, NOTE_D5, 8, NOTE_FS4, 4, NOTE_GS4, 4,
  NOTE_CS5, 8, NOTE_B4, 8, NOTE_D4, 4, NOTE_E4, 4,
  NOTE_B4, 8, NOTE_A4, 8, NOTE_CS4, 4, NOTE_E4, 4,
  NOTE_A4, 2
};

int notes = sizeof(melody) / sizeof(melody[0]) / 2;
int tempo = 180;
int wholenote = (60000 * 4) / tempo;

void setup() {
  // Initialize the LCD
  lcd.init();
  // Turn on backlight
  lcd.backlight();

  // Initialize pins 2 to 11 as outputs for LEDs
  for (int i = 2; i <= 11; i++) {
    pinMode(i, OUTPUT);
  }
}

void loop() {
  // Print action on LCD for even LEDs
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Even LEDs ON");
  delay(1000);

  // Chase LEDs with even numbers
  for (int pin = 2; pin <= 11; pin += 2) {
    digitalWrite(pin, HIGH);
    delay(1000);
    digitalWrite(pin, LOW);
  }
  delay(3000);

  // Print action on LCD for odd LEDs
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Odd LEDs ON");
  delay(1000);

  // Chase LEDs with odd numbers
  for (int pin = 3; pin <= 11; pin += 2) {
    digitalWrite(pin, HIGH);
    delay(1000);
    digitalWrite(pin, LOW);
  }
  delay(3000);

  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print(" BY ARVIND PATIL");
  delay(1000);

lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("NOKIA TUNE STARTS");
  delay(1000);





  // Play Nokia Tune
  for (int i = 0; i < 3; i++) {
    for (int thisNote = 0; thisNote < notes; thisNote++) {
      // calculates the duration of each note
      int noteDuration = (wholenote) / melody[thisNote * 2 + 1];
      if (melody[thisNote * 2 + 1] < 0) {
        noteDuration *= 1.5;
      }
      tone(buzzer, melody[thisNote * 2], noteDuration);
      delay(noteDuration * 1.2); // slight pause between notes
      noTone(buzzer);
    }
    delay(5000); // Pause between repetitions
  }
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
led9:A
led9:C
led10:A
led10:C
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL
bz1:1
bz1:2