//By NMD Weerasinghe SLCOTM
// this is without parameter passing
// you need to define many functions asssigning values for each cases
//here we 'll make a function to tun on any LED we want
//and another Function to Turn off any LED
//int LED_NUM =5;
void setup() {
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
Serial.begin(9600);
//Serial.println("LED_NUM : ");
//Serial.println(LED_NUM);
}
void loop() {
LED(1,1);
delay(1000);
LED(2,HIGH);
delay(1000);
LED(3,true);
delay(1000);
LED(3,LOW);
delay(1000);
LED(1,false);
delay(1000);
LED(2,0);
delay(1000);
//Serial.println("LED_NUM : ");
//Serial.println(LED_NUM);
/*
LED1_ON();
delay(1000);
LED2_ON();
delay(1000);
LED1_OFF();
delay(1000);
LED2_OFF();
delay(1000);
*/
}
void LED( int LED_NUM, bool Status)// tur on any led
{
digitalWrite(LED_NUM + 1, Status);
}
/*
void LED1_ON()
{
digitalWrite(2, HIGH);
}
void LED2_ON()
{
digitalWrite(3, HIGH);
}
void LED1_OFF()
{
digitalWrite(2, LOW);
}
void LED2_OFF()
{
digitalWrite(3, LOW);
}
*/