Final program for the test of the RGB sensor
Dependencies: ISL29125 SDFileSystem mbed
main.cpp@1:e0fc716e2394, 2016-03-12 (annotated)
- Committer:
- Jeriah
- Date:
- Sat Mar 12 00:01:03 2016 +0000
- Revision:
- 1:e0fc716e2394
- Parent:
- 0:547856de255b
- Child:
- 2:04c2f253ec87
Final edition of RGB_test program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeriah | 0:547856de255b | 1 | //Authors: Tom, Nathan, Jeriah |
Jeriah | 0:547856de255b | 2 | #include "mbed.h" |
Jeriah | 0:547856de255b | 3 | #include "RGBSensor.h" |
Jeriah | 0:547856de255b | 4 | #include "SDFileSystem.h" |
Jeriah | 0:547856de255b | 5 | #include "SDSave.h" |
Jeriah | 0:547856de255b | 6 | |
Jeriah | 1:e0fc716e2394 | 7 | |
Jeriah | 0:547856de255b | 8 | Timer t; |
Jeriah | 0:547856de255b | 9 | |
Jeriah | 0:547856de255b | 10 | int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function |
Jeriah | 0:547856de255b | 11 | float lastTime = 0; |
Jeriah | 0:547856de255b | 12 | float interval = 0.5; |
Jeriah | 0:547856de255b | 13 | t.start(); |
Jeriah | 0:547856de255b | 14 | if (mountFailure()) { |
Jeriah | 0:547856de255b | 15 | return -1; //end program with error status |
Jeriah | 0:547856de255b | 16 | } |
Jeriah | 0:547856de255b | 17 | uint16_t rgb[3]; |
Jeriah | 0:547856de255b | 18 | while (t.read()>60) { |
Jeriah | 0:547856de255b | 19 | if (t.read()>lastTime+interval) { |
Jeriah | 0:547856de255b | 20 | lastTime=t.read(); |
Jeriah | 0:547856de255b | 21 | get_rgb(rgb); |
Jeriah | 1:e0fc716e2394 | 22 | writeData_testRGB(lastTime,rgb[0],rgb[1],rgb[2]);//send data to writeData in SDsave.cpp |
Jeriah | 0:547856de255b | 23 | //we will get all rgb readings through an array, with the corresponding integers going in order red, green, blue |
Jeriah | 0:547856de255b | 24 | } |
Jeriah | 0:547856de255b | 25 | } |
Jeriah | 0:547856de255b | 26 | closeDataFile(); |
Jeriah | 0:547856de255b | 27 | } |
Jeriah | 0:547856de255b | 28 |