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

Create an LED Class #2

Open
theDataSmith opened this issue Dec 6, 2016 · 1 comment
Open

Create an LED Class #2

theDataSmith opened this issue Dec 6, 2016 · 1 comment
Assignees

Comments

@theDataSmith
Copy link
Contributor

theDataSmith commented Dec 6, 2016

This class represents an RGB (red-green-blue) LED. An RGB LED is a light emitting diode that has three channels, one for each color. By varying the brightness of each of the three channels, an RGB LED can create any color.

It will send a voltage to each of three pins to control the brightness of each channel. The constructor should take the three pins as arguments and store them.

Needed Arduino Functions:
pinMode()
analogWrite()

The class should have the following public functions:

  • void setRGB(int r, int g, int b)
    • Takes three ints between 0-255 and sets the color accordingly.
  • void setRGB(float r, float g, float b)
    • Takes three floats between 0-1 and sets the color accordingly.
  • void setHSV(float h, float s, float v)
    • Takes three floats between 0-1. It will need to convert the hue, saturation, and value into red, green, and blue.
@elikrause96
Copy link

elikrause96 commented Dec 9, 2016 via email

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

No branches or pull requests

4 participants