Kana Sekiguchi / Mbed 2 deprecated FullcolorLED

Dependencies:   mbed

main.cpp

Committer:
gu_420k
Date:
2013-06-13
Revision:
0:4e6dbadc83fc
Child:
1:a8c211c1aff9

File content as of revision 0:4e6dbadc83fc:

#include "mbed.h"
#include "Serial.h"

Serial pc(USBTX, USBRX);
PwmOut r(p21), g(p22), b(p23);
int main(){
  r.period(0.02);
  g.period(0.02);
  b.period(0.02);

  r = 1;
  g = 1;
  b = 1;

  while(1){
    char c=pc.getc();
    switch(c){
    case 'r':
      r = 0;
      g = 1;
      b = 1;
      break;
    case 'g':
      r = 1;
      g = 0;
      b = 1;
      break;
    case 'b':
      r = 1;
      g = 1;
      b = 0;
      break;
    }
  }
}