with the tof code
Dependencies: mbed Servo ros_lib_kinetic
RGB_LED/LED.h@9:326b8f261ef0, 2020-01-04 (annotated)
- Committer:
- Alexshawcroft
- Date:
- Sat Jan 04 21:35:25 2020 +0000
- Revision:
- 9:326b8f261ef0
- Parent:
- 7:8248af58df5a
oh
Who changed what in which revision?
User | Revision | Line number | New 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 | { |
Alexshawcroft | 9:326b8f261ef0 | 17 | |
Stumi | 5:bc5081f0c063 | 18 | public: |
Stumi | 6:2cc2aac35868 | 19 | cRGB_LED(DigitalOut DIAG_RED, PwmOut DIAG_BLU, PwmOut DIAG_GRN); //Constructor, initialises the 3 outputs |
Stumi | 6:2cc2aac35868 | 20 | void red_led(); //Turns on Red LED |
Stumi | 6:2cc2aac35868 | 21 | void blue_led(); //Turns on Blue LED |
Stumi | 6:2cc2aac35868 | 22 | void green_led(); //Turns on Green LED |
Stumi | 6:2cc2aac35868 | 23 | void yellow_led(); //Turns on multiple LEDs to make yellow |
Stumi | 7:8248af58df5a | 24 | void orange_led(); //Turns on multiple LEDs to make orange |
Stumi | 6:2cc2aac35868 | 25 | void led_off(); //Turns all LEDs off |
Stumi | 7:8248af58df5a | 26 | void record_power(float vBatt); //Saves power value to private variable for use inside class |
Stumi | 7:8248af58df5a | 27 | void display_power(); //Sets LED colour based on battery level |
Stumi | 5:bc5081f0c063 | 28 | private: |
Stumi | 5:bc5081f0c063 | 29 | DigitalOut _DIAG_RED; |
Stumi | 6:2cc2aac35868 | 30 | PwmOut _DIAG_BLU; |
Stumi | 5:bc5081f0c063 | 31 | PwmOut _DIAG_GRN; |
Stumi | 7:8248af58df5a | 32 | float _battery_level; |
Stumi | 5:bc5081f0c063 | 33 | }; |
Stumi | 5:bc5081f0c063 | 34 | |
Stumi | 5:bc5081f0c063 | 35 | |
Stumi | 5:bc5081f0c063 | 36 | #endif |