Alexander De Geeter
/
RGB-LED
voor rian
lib/rgb.cpp@0:ff4d23667e75, 2015-10-23 (annotated)
- Committer:
- de_geeter_alexander
- Date:
- Fri Oct 23 08:36:18 2015 +0000
- Revision:
- 0:ff4d23667e75
lol
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
de_geeter_alexander | 0:ff4d23667e75 | 1 | #include "rgb.h" |
de_geeter_alexander | 0:ff4d23667e75 | 2 | |
de_geeter_alexander | 0:ff4d23667e75 | 3 | |
de_geeter_alexander | 0:ff4d23667e75 | 4 | Rgb::Rgb(PinName r_pin, PinName g_pin, PinName b_pin) { |
de_geeter_alexander | 0:ff4d23667e75 | 5 | |
de_geeter_alexander | 0:ff4d23667e75 | 6 | rout = new PwmOut(r_pin); |
de_geeter_alexander | 0:ff4d23667e75 | 7 | gout = new PwmOut(g_pin); |
de_geeter_alexander | 0:ff4d23667e75 | 8 | bout = new PwmOut(b_pin); |
de_geeter_alexander | 0:ff4d23667e75 | 9 | } |
de_geeter_alexander | 0:ff4d23667e75 | 10 | |
de_geeter_alexander | 0:ff4d23667e75 | 11 | void Rgb::setColor(int red, int green, int blue) { |
de_geeter_alexander | 0:ff4d23667e75 | 12 | rout->write(255-red); |
de_geeter_alexander | 0:ff4d23667e75 | 13 | gout->write(255-green); |
de_geeter_alexander | 0:ff4d23667e75 | 14 | bout->write(255-blue); |
de_geeter_alexander | 0:ff4d23667e75 | 15 | } |