Sensor Data - first assignment CO838

Dependencies:   mbed C12832 FXOS8700Q LM75B eCompass_FPU_Lib

Sensor Data - Project developed by Jean-Paul Saysana (jls44)

First assignment for the Internet of Things and Mobile Devices CO838 module

University of Kent (2016-2017)

Functionalities:

- Temperature Sensor

- Compass

- Music box

- Potentiometer that changes LED colours

Libraries used: C12832, eCompass_FPU_Lib, FXOS8700Q, LM75B

Committer:
co838_jls44
Date:
Fri Feb 24 14:33:41 2017 +0000
Revision:
1:c54902f21aa8
Parent:
0:4b83b332b327
comment about the playnote method

Who changed what in which revision?

UserRevisionLine numberNew contents of line
co838_jls44 0:4b83b332b327 1 /* Developed by Jean-Paul Saysana - jls44 - MSc Student in Computer Security*/
co838_jls44 0:4b83b332b327 2 /* Internet of Things and Mobile Devices - CO838 University of Kent*/
co838_jls44 0:4b83b332b327 3
co838_jls44 0:4b83b332b327 4 #include "LED.h"
co838_jls44 0:4b83b332b327 5
co838_jls44 0:4b83b332b327 6 LED::LED(PinName R, PinName G, PinName B) : red(R), green(G), blue(B) {
co838_jls44 0:4b83b332b327 7 }
co838_jls44 0:4b83b332b327 8
co838_jls44 0:4b83b332b327 9 /* switch on selected color of led and turn off the rest. */
co838_jls44 0:4b83b332b327 10 void LED::SwitchOn(eLED color) {
co838_jls44 0:4b83b332b327 11 switch (color) {
co838_jls44 0:4b83b332b327 12 case RED:
co838_jls44 0:4b83b332b327 13 red = 1;
co838_jls44 0:4b83b332b327 14 SwitchOff(blue);
co838_jls44 0:4b83b332b327 15 SwitchOff(green);
co838_jls44 0:4b83b332b327 16 break;
co838_jls44 0:4b83b332b327 17 case BLUE:
co838_jls44 0:4b83b332b327 18 blue = 1;
co838_jls44 0:4b83b332b327 19 SwitchOff(red);
co838_jls44 0:4b83b332b327 20 SwitchOff(green);
co838_jls44 0:4b83b332b327 21 break;
co838_jls44 0:4b83b332b327 22 case GREEN:
co838_jls44 0:4b83b332b327 23 green = 1;
co838_jls44 0:4b83b332b327 24 SwitchOff(blue);
co838_jls44 0:4b83b332b327 25 SwitchOff(red);
co838_jls44 0:4b83b332b327 26 break;
co838_jls44 0:4b83b332b327 27 };
co838_jls44 0:4b83b332b327 28 }
co838_jls44 0:4b83b332b327 29
co838_jls44 0:4b83b332b327 30 /* switch off selected led */
co838_jls44 0:4b83b332b327 31 void LED::SwitchOff(DigitalOut p) {
co838_jls44 0:4b83b332b327 32 p = 0;
co838_jls44 0:4b83b332b327 33 }
co838_jls44 0:4b83b332b327 34
co838_jls44 0:4b83b332b327 35 /* switch off every led (white) */
co838_jls44 0:4b83b332b327 36 void LED::SwitchOffAll() {
co838_jls44 0:4b83b332b327 37 red = 0;
co838_jls44 0:4b83b332b327 38 green =0;
co838_jls44 0:4b83b332b327 39 blue = 0;
co838_jls44 0:4b83b332b327 40 }