/* Software serial multple serial test Receives from the hardware serial, sends to software serial. Receives from software serial, sends to hardware serial. The circuit: * RX is digital pin 10 (connect to TX of other device) * TX is digital pin 11 (connect to RX of other device) Note: Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI). created back in the mists of time modified 25 May 2012 by Tom Igoe based on Mikal Hart's example This example code is in the public domain. */ // 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 // variables will change: int buttonState; // variable for reading the pushbutton status // resources: #include //load serial library SoftwareSerial mySerial(0, 1); // Serial definition: name(pins)(RX, TX) // int buttonState; void setup() { pinMode(ledPin, OUTPUT); // initialize the LED pin as an output: pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input: // pinMode(3, INPUT); mySerial.begin(115200); //serial.start(baudios velocity) } void loop() { buttonState = digitalRead(3); // buttonState = digitalRead(buttonPin); // read the state of the pushbutton value: if(buttonState == LOW){ // check if the pushbutton is pressed mySerial.println("light"); //print text mySerial.println("light"); //print text mySerial.println("=) MORNING!"); //print text mySerial.println("light"); //print text mySerial.println("light"); //print text digitalWrite(ledPin, HIGH); // turn LED on } else { mySerial.println("dark"); //print text mySerial.println("dark"); //print text mySerial.println("GOODNIGHT..."); //print text mySerial.println("dark"); //print text mySerial.println("dark"); //print text digitalWrite(ledPin, LOW); // turn LED off } }