Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch led #19

Open
vickyhat opened this issue Feb 9, 2023 · 0 comments
Open

Switch led #19

vickyhat opened this issue Feb 9, 2023 · 0 comments

Comments

@vickyhat
Copy link

vickyhat commented Feb 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant