char val;//the variable val uses caracters only void setup() { pinMode(5,OUTPUT);//set the pin 5 in samd11c as output digitalWrite(5,LOW);//set it to low at the begining of the sketch Serial.begin(115200);//start serial communications } void loop() { val=Serial.read();//read the value of the serial monitor and store it on "val" switch (val)//swtch when the variable "val" changes to { case '0': //character "0" digitalWrite(5,LOW);//set the pin to LOW Serial.println("you just turned OFF the Relay");//write this message on serial monitor break; case '1'://character "1" digitalWrite(5,HIGH);//set pin to high Serial.println("you just turned ON the Relay");//write this message on serial monitor break; } }