//MOHAMAD IBRANSYAH PRAYOGI(17)/XII - L1.
void setup() {
pinMode(11, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(9, OUTPUT);
}
void loop() {
// Penggunaan operator logika And(&&)
if (digitalRead(11)== 0 && digitalRead(10)== 1)
{digitalWrite(9, 1);}
else {digitalWrite(9, 0);}
if (digitalRead(11)== 1 && digitalRead(10)== 0)
{digitalWrite(9, 1);}
else {digitalWrite(9, 0);}
if (digitalRead(11)== 0 && digitalRead(10)== 0)
{digitalWrite(9,1);}
else {digitalWrite(9, 0);}
//penggunaan operator logika Or(||)
if (digitalRead(11)== 0 || digitalRead(10)== 0)
{digitalWrite(9, 1);}
else{digitalWrite(9, 0);}
//penggunaan operator logika NOT (!)
if (digitalRead(11)== 1 != digitalRead(10)== 1)
{digitalWrite(9, 1);}
else{digitalWrite(9, 0);}
}