//*******BUTTON SIDE CODES*********
const int SW_ON = 6; // the number of the pushbutton pin
const int SW_OFF = 7; // the number of the pushbutton pin
const int ledPin = 9; // the number of the LED pin
int lamba = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(SW_ON, INPUT);
pinMode(SW_OFF, INPUT);
Serial.begin(9600);
lamba=0;
}
void loop() {
delay(100);
if(digitalRead(SW_ON)== LOW){ digitalWrite(ledPin, LOW); delay(250); lamba=1;}
if(digitalRead(SW_OFF)== LOW){ digitalWrite(ledPin, HIGH); delay(250); lamba=0;}
if(lamba==1) Serial.print("A"); else Serial.print("K");
}
//************LAMP SIDE CODES ***************
const int ledPin = 9; // the number of the LED pin
int lamba = 0;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
lamba=0;
}
void loop() {
if (Serial.available() > 0) {
lamba = Serial.read();
if(lamba == 75) {digitalWrite(ledPin, LOW);}
if(lamba == 65) {digitalWrite(ledPin, HIGH);}
}
}
Comments