1) To
turn on the red led (PF1)
Method 1
Method 1
void setup()
{
pinMode(PF_1, OUTPUT);
}
void loop()
{
digitalWrite(PF_1, HIGH); //
turn the LED on (HIGH is the voltage level)
}
Method 2
void setup()
{
pinMode(PF_1,1); //sets PF1 pin as output(RED LED locate here)
//1--> FOR OUTP
}
void loop()
{
digitalWrite(PF_1,1); // Sets PF1 in Logic high state(RED LED on)
//1--> FOR Logic
high, 1--> FOR Logic low
}
3) To
blink red led (PF1)
void setup()
{
pinMode(PF_1, OUTPUT); //sets PF1
pin as output(RED LED locate here)
}
void loop()
{
digitalWrite(PF_1, HIGH); //
Sets PF1 in high state(RED LED on)
delay(1000); // 500
milliseconds delay -on time
digitalWrite(PF_1, LOW); // Sets
PF1 in high state(RED LED off)
delay(1000); // 500
milliseconds delay -off time
}
4) To blink Green led (PF3)
/*
Blink green led
*/
void setup()
{
pinMode(PF_3, OUTPUT); // setting PF.3 Pin as output
}
void loop() {
digitalWrite(PF_3, HIGH); // turn the GREEN LED on
delay(1000); // wait for a second
digitalWrite(PF_3, LOW); // turn the GREEN LED off by making the voltage LOW
delay(1000); // wait for a second
}
4) To blink Green led (PF3)
/*
Blink green led
*/
void setup()
{
pinMode(PF_3, OUTPUT); // setting PF.3 Pin as output
}
void loop() {
digitalWrite(PF_3, HIGH); // turn the GREEN LED on
delay(1000); // wait for a second
digitalWrite(PF_3, LOW); // turn the GREEN LED off by making the voltage LOW
delay(1000); // wait for a second
}
5) To
blink the red, blue , green led’s
alternatively
void setup()
{
pinMode(PF_1,
OUTPUT); //sets PF1 pin as output(RED
LED locate here)
pinMode(PF_2, OUTPUT); //sets PF2 pin as output(BLUE LED locate
here)
pinMode(PF_3, OUTPUT); //sets PF3 pin as output(GREEN LED locate
here)
}
void loop()
{
digitalWrite(PF_1, HIGH); // Sets PF1 in high state(RED LED on)
digitalWrite(PF_3, LOW); // Sets PF2 in high state(GREEN LED off)
delay(500);
digitalWrite(PF_2, HIGH); // Sets PF2 in high state(BLUE LED on)
digitalWrite(PF_1, LOW); // Sets PF1 in high state(RED LED off)
delay(500);
digitalWrite(PF_2, LOW); // Sets PF2 in high state(BLUE LED off)
digitalWrite(PF_3, HIGH); // Sets PF2 in high state(GREEN LED on)
delay(500);
}