// These two Pin Use for INPUT;
int Push_button_Led = 8;
int Push_button_Buzz = 9;
int Led_Pin = 10;
int Buzz_Pin = 11;
int Led_bright = 0;
int Led_val;
int buzz_val;
int delay_T = 500;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(Push_button_Led, INPUT);
pinMode(Push_button_Buzz, INPUT);
pinMode(Led_Pin, OUTPUT);
pinMode(Buzz_Pin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Led_val = digitalRead(Push_button_Led);
buzz_val = digitalRead(Push_button_Buzz);
Serial.print(" LED Value = ");
Serial.print(Led_val);
Serial.print(" ");
Serial.print("BUZZER Value = ");
Serial.println(buzz_val);
if (Led_val == 0) {
Led_bright = Led_bright + 5;
} else if (buzz_val == 0) {
Led_bright = Led_bright - 5;
}
if (Led_bright > 255) {
Led_bright = 255;
digitalWrite(Buzz_Pin, HIGH);
delay(delay_T);
digitalWrite(Buzz_Pin, LOW);
} else if (Led_bright < 0) {
Led_bright = 0;
digitalWrite(Buzz_Pin, HIGH);
delay(delay_T);
digitalWrite(Buzz_Pin, LOW);
}
analogWrite(Led_Pin, Led_bright);
Serial.print("LED_Brightness = is ");
Serial.print(Led_bright);
delay(delay_T);
}