![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Final program for the test of the RGB sensor
Dependencies: ISL29125 SDFileSystem mbed
Diff: main.cpp
- Revision:
- 2:04c2f253ec87
- Parent:
- 1:e0fc716e2394
- Child:
- 3:8ace1992bc93
--- a/main.cpp Sat Mar 12 00:01:03 2016 +0000 +++ b/main.cpp Sat Mar 12 01:40:42 2016 +0000 @@ -6,23 +6,37 @@ Timer t; +DigitalOut ledBlue(LED_BLUE); +DigitalOut ledRed(LED_RED); +Serial pc(USBTX,USBRX); 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; + ledRed = 0; + ledBlue = 1; + wait(0.5); + RGB_init(); t.start(); - if (mountFailure()) { + pc.printf("The timer has started\n\r"); + if (mountSDCard()) { return -1; //end program with error status } + pc.printf("The SD card is mounted\n\r"); + createDataFile_testRGB(); uint16_t rgb[3]; - while (t.read()>60) { - if (t.read()>lastTime+interval) { + ledRed = 1; + while (t.read()<60) { + if (t.read()>(lastTime+interval)) { lastTime=t.read(); get_rgb(rgb); + pc.printf("t = %.2f \t red = %d \t green = %d\r\n",lastTime,rgb[0],rgb[1]); 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(); + ledBlue = 0; + while (true) {}; } \ No newline at end of file