itsharryle/LED_CUBE

Switch led

Opened this issue · 0 comments

In this example, we will write code for a switch that will turn on an LED.

To do this, we will need to include the LED library and create a function to turn on the LED.

The code for this example is as follows:

#include <LED.h>

void turnOnLED(int ledPin)

{

// set the LED pin as an output

LED.setPin(ledPin, OUTPUT);

}

To turn on the LED, we first need to set the LED pin as an output. Next, we call the turnOnLED function, passing in the LED pin as the parameter.