#include <SoftwareSerial.h>
// ***
// *** Define the RX and TX pins. Choose any two
// ***
#define RX PB1 // ***
#define TX PB2 // ***
SoftwareSerial Serial(RX, TX);
char entrada = 0; // for incoming serial data
const int led = PB3; //pin 3
void setup() {
Serial.begin(112500); // opens serial port, sets data rate to 9600 bps
pinMode(led, OUTPUT);
}
void loop() {
// send data only when you receive data:
while (Serial.available() > 0) {
// read the incoming byte:
entrada = Serial.read();
Serial.print(entrada);
if (entrada == 'E')
digitalWrite(led, HIGH);
else if (entrada == 'A')
digitalWrite(led, LOW);
}
}