A simple program to control the color of RGB LED.

Dependencies:   mbed

Committer:
tbjazic
Date:
Thu Dec 18 13:33:02 2014 +0000
Revision:
0:e04286461404
Initial commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tbjazic 0:e04286461404 1 #include "mbed.h"
tbjazic 0:e04286461404 2
tbjazic 0:e04286461404 3 PwmOut red(p23);
tbjazic 0:e04286461404 4 PwmOut green(p24);
tbjazic 0:e04286461404 5 PwmOut blue(p25);
tbjazic 0:e04286461404 6
tbjazic 0:e04286461404 7 AnalogIn pot1(p19);
tbjazic 0:e04286461404 8 AnalogIn pot2(p20);
tbjazic 0:e04286461404 9
tbjazic 0:e04286461404 10 DigitalIn center(p14); // joystick center
tbjazic 0:e04286461404 11
tbjazic 0:e04286461404 12 int main() {
tbjazic 0:e04286461404 13 while(1) {
tbjazic 0:e04286461404 14 red = 1 - pot1;
tbjazic 0:e04286461404 15 green = 1 - pot2;
tbjazic 0:e04286461404 16 blue = 1 - center;
tbjazic 0:e04286461404 17 }
tbjazic 0:e04286461404 18 }