Final program for the test of the RGB sensor
Dependencies: ISL29125 SDFileSystem mbed
main.cpp@0:547856de255b, 2016-03-11 (annotated)
- Committer:
- Jeriah
- Date:
- Fri Mar 11 23:43:27 2016 +0000
- Revision:
- 0:547856de255b
- Child:
- 1:e0fc716e2394
wrote the RGBSensor.h file for RGB_test
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 | 0:547856de255b | 7 | SDFileSystem fs(PTE3,PTE1,PTE2,PTE4,"fs");//SDFileSystem object |
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 | 0:547856de255b | 22 | writeDate_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 |