Multi-game multiplayer arcade gaming system meant for the red X when playing Super Tic-Tac-Toe.

Dependencies:   uLCD_4DGL_SE PinDetect SDFileSystem mbed wave_player

Committer:
soapy12312
Date:
Fri Dec 04 23:03:08 2015 +0000
Revision:
2:d35fde2d82cd
Parent:
0:218d3fb75950
Multi-game multiplayer arcade gaming system meant for the red X when playing Super Tic-Tac-Toe.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
soapy12312 2:d35fde2d82cd 1 /******************************************************
soapy12312 2:d35fde2d82cd 2 * This header program declares all the functions and
soapy12312 2:d35fde2d82cd 3 * variables used by RGB LED component.
soapy12312 2:d35fde2d82cd 4 ******************************************************/
soapy12312 2:d35fde2d82cd 5
soapy12312 2:d35fde2d82cd 6
soapy12312 0:218d3fb75950 7 // Class to control an RGB LED using three PWM pins
soapy12312 0:218d3fb75950 8 class RGBLED {
soapy12312 0:218d3fb75950 9 public:
soapy12312 0:218d3fb75950 10 // RGBLED constructor
soapy12312 0:218d3fb75950 11 RGBLED(PinName redPin, PinName greenPin, PinName bluePin) : red(redPin), green(greenPin), blue(bluePin) {
soapy12312 0:218d3fb75950 12 red.period(0.0005);
soapy12312 0:218d3fb75950 13 green.period(0.0005);
soapy12312 0:218d3fb75950 14 blue.period(0.0005);
soapy12312 0:218d3fb75950 15 red = 0.0;
soapy12312 0:218d3fb75950 16 green = 0.0;
soapy12312 0:218d3fb75950 17 blue = 0.0;
soapy12312 0:218d3fb75950 18 }
soapy12312 0:218d3fb75950 19
soapy12312 0:218d3fb75950 20 RGBLED operator=(int color) {
soapy12312 0:218d3fb75950 21 write(color);
soapy12312 0:218d3fb75950 22 return *this;
soapy12312 0:218d3fb75950 23 }
soapy12312 0:218d3fb75950 24
soapy12312 0:218d3fb75950 25
soapy12312 0:218d3fb75950 26 private:
soapy12312 0:218d3fb75950 27 PwmOut red;
soapy12312 0:218d3fb75950 28 PwmOut green;
soapy12312 0:218d3fb75950 29 PwmOut blue;
soapy12312 0:218d3fb75950 30
soapy12312 0:218d3fb75950 31 void write(int color) {
soapy12312 0:218d3fb75950 32 red = (color >> 16) / 255.0 / 16.0;
soapy12312 0:218d3fb75950 33 green = ((color >> 8) & 0xFF) / 255.0 / 16.0;
soapy12312 0:218d3fb75950 34 blue = (color & 0xFF) / 255.0 / 16.0;
soapy12312 0:218d3fb75950 35 }
soapy12312 0:218d3fb75950 36 };