SOFT564Z Group 3 / Mbed 2 deprecated SOFT564Z_Group_3v3

Dependencies:   mbed Servo ros_lib_kinetic

Committer:
Stumi
Date:
Tue Nov 19 12:55:44 2019 +0000
Revision:
7:8248af58df5a
Parent:
6:2cc2aac35868
Child:
9:326b8f261ef0
Added blue user button function and LED to show power status

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Stumi 6:2cc2aac35868 1 /*--------------------------------------------------------------------------------
Stumi 6:2cc2aac35868 2 Filename: LED.h
Stumi 6:2cc2aac35868 3 Description: Header file for the Buzzer and LEDs
Stumi 6:2cc2aac35868 4 --------------------------------------------------------------------------------*/
Stumi 6:2cc2aac35868 5
Stumi 5:bc5081f0c063 6 #include "mbed.h"
Stumi 5:bc5081f0c063 7
Stumi 5:bc5081f0c063 8 #ifndef LED_H
Stumi 5:bc5081f0c063 9 #define LED_H
Stumi 5:bc5081f0c063 10
Stumi 5:bc5081f0c063 11 #define DIAG_GRN PD_14
Stumi 5:bc5081f0c063 12 #define DIAG_BLU PD_15
Stumi 5:bc5081f0c063 13 #define DIAG_RED PF_12
Stumi 5:bc5081f0c063 14
Stumi 6:2cc2aac35868 15 class cRGB_LED
Stumi 5:bc5081f0c063 16 {
Stumi 5:bc5081f0c063 17 public:
Stumi 6:2cc2aac35868 18 cRGB_LED(DigitalOut DIAG_RED, PwmOut DIAG_BLU, PwmOut DIAG_GRN); //Constructor, initialises the 3 outputs
Stumi 6:2cc2aac35868 19 void red_led(); //Turns on Red LED
Stumi 6:2cc2aac35868 20 void blue_led(); //Turns on Blue LED
Stumi 6:2cc2aac35868 21 void green_led(); //Turns on Green LED
Stumi 6:2cc2aac35868 22 void yellow_led(); //Turns on multiple LEDs to make yellow
Stumi 7:8248af58df5a 23 void orange_led(); //Turns on multiple LEDs to make orange
Stumi 6:2cc2aac35868 24 void led_off(); //Turns all LEDs off
Stumi 7:8248af58df5a 25 void record_power(float vBatt); //Saves power value to private variable for use inside class
Stumi 7:8248af58df5a 26 void display_power(); //Sets LED colour based on battery level
Stumi 5:bc5081f0c063 27 private:
Stumi 5:bc5081f0c063 28 DigitalOut _DIAG_RED;
Stumi 6:2cc2aac35868 29 PwmOut _DIAG_BLU;
Stumi 5:bc5081f0c063 30 PwmOut _DIAG_GRN;
Stumi 7:8248af58df5a 31 float _battery_level;
Stumi 5:bc5081f0c063 32 };
Stumi 5:bc5081f0c063 33
Stumi 5:bc5081f0c063 34
Stumi 5:bc5081f0c063 35 #endif