TP7_DS_1_RGBs

Dependencies:   mbed

Committer:
rtk
Date:
Mon Nov 02 22:34:05 2015 +0000
Revision:
0:008bb91fea13
.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rtk 0:008bb91fea13 1 #include "mbed.h"
rtk 0:008bb91fea13 2
rtk 0:008bb91fea13 3 DigitalOut Red(D5) ;
rtk 0:008bb91fea13 4 DigitalOut Green(D9) ;
rtk 0:008bb91fea13 5 DigitalOut Blue(D8) ;
rtk 0:008bb91fea13 6
rtk 0:008bb91fea13 7 AnalogIn Right(A5) ;
rtk 0:008bb91fea13 8 AnalogIn Left(A4) ;
rtk 0:008bb91fea13 9 AnalogIn Up(A2) ;
rtk 0:008bb91fea13 10 AnalogIn Down(A3) ;
rtk 0:008bb91fea13 11 DigitalIn Center(D4) ;
rtk 0:008bb91fea13 12
rtk 0:008bb91fea13 13
rtk 0:008bb91fea13 14 int main()
rtk 0:008bb91fea13 15 {
rtk 0:008bb91fea13 16 while(1) {
rtk 0:008bb91fea13 17 Red = !Up;
rtk 0:008bb91fea13 18 Green = !Down;
rtk 0:008bb91fea13 19 Blue = !Right;
rtk 0:008bb91fea13 20 if (Left) {
rtk 0:008bb91fea13 21 Red = 0;
rtk 0:008bb91fea13 22 Green = 0;
rtk 0:008bb91fea13 23 Blue= 1;
rtk 0:008bb91fea13 24 }
rtk 0:008bb91fea13 25 if (Center) {
rtk 0:008bb91fea13 26 Red = 0;
rtk 0:008bb91fea13 27 Green = 0;
rtk 0:008bb91fea13 28 Blue = 0;
rtk 0:008bb91fea13 29 }
rtk 0:008bb91fea13 30
rtk 0:008bb91fea13 31 }
rtk 0:008bb91fea13 32 }