#include// serial library int bp = 3;// declare that bp(pushbutton)is in pin 3 SoftwareSerial myserial(0, 1); // define the serial and the TX=1 and RX=0 void setup() { pinMode(bp,INPUT_PULLUP) ;// Declare that pudhbutton is an input myserial.begin(9600); } void loop() { int bps = 0; bps = digitalRead(bp); if (bps == LOW) //if the pushbutton is pressed this condition will be true { myserial.write('1');// send this char } else { myserial.write('0');//if the pushbutton is not pressed sen this char } delay(100); }