// by N M D Weerasinghe SLCOTM
String Incomming_msg = "";
void setup() {
// put your setup code here, to run once:
for (int i=2; i<6;i++)
{
pinMode(i, OUTPUT); // define PIN mode
digitalWrite(i, LOW); // Turn off LEDs
}
Serial.begin(9600);
Serial.println();
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available()>0)
{
Incomming_msg = Serial.readString();
if(Incomming_msg.toInt() % 2)
{
digitalWrite(((Incomming_msg.toInt() +1)/2) +1 ,1);
}
else
{
digitalWrite(((Incomming_msg.toInt())/2) +1,0);
}
}
}