#include SoftwareSerial mySerial(3,4); int valor; void setup() { // put your setup code here, to run once: mySerial.begin(9600); pinMode(0,OUTPUT); } void loop() { // put your main code here, to run repeatedly: if (mySerial.available() > 0) { valor = mySerial.read(); if (valor=='1'){ digitalWrite(0,LOW); } if (valor=='2'){ digitalWrite(0,HIGH); } } }