int Bpin = 3;
int Lpin = 11;
bool state = 0;
void setup() {
// put your setup code here, to run once:
pinMode(Lpin, OUTPUT);
pinMode(Bpin, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
state = digitalRead(Bpin);
if (state==HIGH){
digitalWrite(Lpin, HIGH);
}
else {
digitalWrite(Lpin,LOW);
}
}