//Alzubair Alshehhi //FabAcademy 2018 #include // constants won't change. They're used here to set pin numbers: const int buttonPin = 3; // the number of the pushbutton pin const int ledPin = 7; // the number of the LED pin int buttonState = 0; // variable for reading the pushbutton status SoftwareSerial myserial(0,1); void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT_PULLUP); //pullup because it fixed the static issue with the button. myserial.begin(9600); } void loop() { buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. If it is, the buttonState is HIGH: Low and High are flipped in this code, you can change them if you want but you will need to change the mapping to counter clockwise if (buttonState == LOW) { // turn LED on: digitalWrite(ledPin, LOW); //Charcter Command Sent to Reciver myserial.write('2'); delay(100); } else { // turn LED off: digitalWrite(ledPin, HIGH); delay(2000); //turn LED on digitalWrite(ledPin, LOW); myserial.print("Nothing is Sent.."); delay(100); } }