PRO2_Team 1_collected code with ticker and headers_not working yet
Fork of PRO2_samlet_kode by
Diff: data_out.cpp
- Revision:
- 7:75d5c1db2027
- Parent:
- 6:12f1849aad21
--- a/data_out.cpp Wed May 24 11:19:51 2017 +0000 +++ b/data_out.cpp Sun May 28 20:36:29 2017 +0000 @@ -1,5 +1,5 @@ /* -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- -- Project: PRO2 "Awareness and Optimisation of energy consumption" -- Team: Team 1 @@ -9,12 +9,13 @@ -- Copyright: Open to all -- Version: 0.6 - Creation of file. -- 0.7 - Added a 5th choice for colour. Red_Blink. +-- 1.0 - Finished file. -- -- Description: A program (for a school project) that needs to collect -- data from sensors, and show an output to 3 seven-segmented -- displays and to a RGB-LED. -- -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- */ #include "mbed.h" @@ -27,12 +28,13 @@ RGB_LED lamp(PC_8,PC_6,PB_9); // Creates an object out of the class RGB_LED. // Connect pins on the Nucleo, to the pins the // class. -// Following is a object of the class segment_7. It is the actual analogy -// to our 7 segmented displays. There needs to go 11 pins into the parenteses. -//segment_7 seg_num(11 pins); + // Following is a object of the class segment_7. It is the actual analogy + // to our 7 segmented displays. There needs to go 11 pins into the + // parenteses. + // segment_7 seg_num(11 pins); - enum colour { // Enumeration is used only for making the program more - // easily readable. + enum colour // Enumeration is used only for making the program more + { // easily readable. green, // Is alike an int, starts at green = 1, orange, // orange = 2 etc. red, @@ -44,7 +46,8 @@ // Taking the value from the sensors and change them the enum type. // Enum is somewhat akin to an int already, but RGB_out != status.. - switch(RGB_out) { + switch(RGB_out) + { case green: lamp.set(0.0f, 1.0f, 0.0f); lamp.flash(1.0f, 1.0f); // On constantly. @@ -66,8 +69,8 @@ lamp.flash(2.0f, 0.5f); // On for 50% of every 2 seconds. break; default: // Error has occured, blue. Could just have defaulted instead - lamp.set(0.0f, 0.0f, 1.0f); // of case blue, however I think - lamp.flash(2.0f, 0.5f); // this is more understandable. + lamp.set(0.0f, 0.0f, 1.0f); // of case blue, however as it is an + lamp.flash(2.0f, 0.5f); // error and blue is error.. } return;