PRO2_Team 1_collected code with ticker and headers_not working yet
Fork of PRO2_samlet_kode by
Diff: rgb_led.cpp
- Revision:
- 6:12f1849aad21
- Parent:
- 0:21e9cc38dd31
- Child:
- 7:75d5c1db2027
--- a/rgb_led.cpp Wed May 24 09:34:54 2017 +0000 +++ b/rgb_led.cpp Wed May 24 11:19:51 2017 +0000 @@ -1,28 +1,31 @@ /* -================================================================================ -== == == -== Source File: == main.cpp == -== File Name: == rgb_led.cpp == -== Author: == Poul Erik Tjørnfelt == -== Date: == 07/05-2017 == -== Copyright: == Open to all == -== Version: == 0.6 - Creation of file. == -== == == -== Description: == The .cpp file for a class, that creates instances of == -== == the actual RGB lamp that is used. == -== == == -================================================================================ +------------------------------------------------------------------------------- +-- Project: PRO2 "Awareness and Optimisation of energy consumption" +-- Team: Team 1 + +-- File Name: rgb_led.cpp +-- Author: Poul Erik Tjørnfelt +-- Date: 07/05-2017 +-- Copyright: Open to all +-- Version: 0.6 - Creation of file. +-- +-- Description: The .cpp file for a class, that creates instances of +-- the actual RGB lamp that is used. +-- +-- +------------------------------------------------------------------------------- */ + #include "mbed.h" #include "rgb_led.h" RGB_LED::RGB_LED(PinName pin_R, PinName pin_G, PinName pin_B) - :pin_r(pin_R), pin_g(pin_G), pin_b(pin_B) // Constructor + :pin_r(pin_R), pin_g(pin_G), pin_b(pin_B) // Constructor { } - + void RGB_LED::set(float red,float green, float blue) { pin_r = red; // The amount of the single colours that we want in the @@ -39,6 +42,6 @@ pin_r.write(on_timer); // The %age of the period that the LED is turned on. pin_g.period(period); pin_g.write(on_timer); - pin_b.period(period); - pin_b.write(on_timer); + pin_b.period(period); + pin_b.write(on_timer); } \ No newline at end of file