Final program for the test of the RGB sensor

Dependencies:   ISL29125 SDFileSystem mbed

main.cpp

Committer:
Jeriah
Date:
2016-03-12
Revision:
1:e0fc716e2394
Parent:
0:547856de255b
Child:
2:04c2f253ec87

File content as of revision 1:e0fc716e2394:

  //Authors: Tom, Nathan, Jeriah 
#include "mbed.h"
#include "RGBSensor.h"
#include "SDFileSystem.h"
#include "SDSave.h"


Timer t;

int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function
    float lastTime = 0;
    float interval = 0.5;
    t.start();
    if (mountFailure()) {
        return -1; //end program with error status
    }
    uint16_t rgb[3];
    while (t.read()>60) {
      if (t.read()>lastTime+interval)  {
          lastTime=t.read();
          get_rgb(rgb);
          writeData_testRGB(lastTime,rgb[0],rgb[1],rgb[2]);//send data to writeData in SDsave.cpp
          //we will get all rgb readings through an array, with the corresponding integers going in order red, green, blue
        }
    }
    closeDataFile();
}