Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RGBLed.cpp
- Committer:
- jensva
- Date:
- 2021-02-05
- Revision:
- 1:f2ac6d53f63d
- Parent:
- 0:396b3f9574ea
File content as of revision 1:f2ac6d53f63d:
#include "RGBLed.h"
RGBLed::RGBLed(PinName redPin, PinName greenPin, PinName bluePin) : m_red(redPin), m_green(greenPin), m_blue(bluePin)
{
}
void RGBLed::init()
{
m_red.period(0.001);
}
void RGBLed::setColor(const float red, const float green, const float blue)
{
// Negative logic
m_red = 1.f - red;
m_green = 1.f - green;
m_blue = 1.f - blue;
}