Skip to content

Commit 19547ce

Browse files
committed
arduino 4 is for infrared array data
1 parent f611231 commit 19547ce

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#include "arduino_4_lib.h"
2+
3+
const int ArduinoTypeID = 4;
4+
5+
Adafruit_BNO055 bno_0 = Adafruit_BNO055(55, BNO055_ADDRESS_A);
6+
Adafruit_BNO055 bno_1 = Adafruit_BNO055(56, BNO055_ADDRESS_B);
7+
//Adafruit_BNO055 bno = bno_0;
8+
9+
struct measurementsStruct{
10+
String current_time;
11+
float face_temparature_hottest;
12+
};
13+
14+
std::vector<String> columns = {
15+
"Timestamp",
16+
"FaceTemperatureHottest",
17+
};
18+
19+
int incr = 0;
20+
const int QUEUE_SIZE = 500;
21+
struct measurementsStruct dataArray[QUEUE_SIZE];
22+
struct measurementsStruct *P_send = dataArray;
23+
struct measurementsStruct *P_receive = NULL;
24+
int pixelTable[64];
25+
26+
float testPixelValue = 0;
27+
28+
29+
30+
31+
void grideyeInit(){
32+
// Start your preferred I2C object
33+
Wire.begin();
34+
// Library assumes "Wire" for I2C but you can pass something else with begin() if you like
35+
grideye.begin();
36+
}
37+
38+
void arduinoInit(){
39+
grideyeInit();
40+
}
41+
42+
43+
void Task_ReadingData(void *pvParameters){
44+
while (true) {
45+
if (do_measurements) {
46+
// sensors_event_t event;
47+
// bno.getEvent(&event);
48+
struct measurementsStruct measurements;
49+
50+
measurements.current_time = dateTime(TIME_FORMAT);
51+
52+
float hotPixelValue = 0;
53+
int hotPixelIndex = 0;
54+
55+
for(unsigned char i = 0; i < 64; i++){
56+
testPixelValue = grideye.getPixelTemperature(i);
57+
if (testPixelValue > hotPixelValue){
58+
hotPixelValue = testPixelValue;
59+
hotPixelIndex = i;
60+
}
61+
}
62+
63+
measurements.face_temparature_hottest = hotPixelValue;
64+
65+
dataArray[incr] = measurements;
66+
67+
P_send = dataArray+incr;
68+
69+
incr = (incr + 1) % QUEUE_SIZE;
70+
71+
xQueueSend(queue, &P_send, portMAX_DELAY);
72+
// delay(1);
73+
} else {
74+
delay(IDLE_DELAY); // THAT'S JUST IN CASE do_measurements == false
75+
}
76+
}
77+
}
78+
79+
void Task_WritingData(void *pvParameters){
80+
while (true) {
81+
xQueueReceive(queue, &P_receive, portMAX_DELAY);
82+
83+
myFile.print(P_receive -> current_time);
84+
myFile.print(DELIMITER);
85+
86+
87+
88+
89+
myFile.print('\n');
90+
myFile.flush();
91+
}
92+
}
93+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef arduino_4_lib
2+
#define arduino_4_lib
3+
4+
#include "../eSportsLibrary/eSportsLibrary.h"
5+
#include <Adafruit_BME280.h>
6+
#include <SparkFun_GridEYE_Arduino_Library.h>
7+
#include <Wire.h>
8+
9+
10+
extern const int ArduinoTypeID;
11+
extern const int IDLE_DELAY;
12+
13+
//extern Adafruit_BME280 bme; //I2C
14+
extern Adafruit_BNO055 bno;
15+
16+
extern std::vector<String> columns;
17+
18+
void bmeInit();
19+
void bnoInit();
20+
void arduinoInit();
21+
void Task_WritingData(void *pvParameters);
22+
void Task_ReadingData(void *pvParameters);
23+
24+
25+
#endif //TEST_LIBRARY_H

0 commit comments

Comments
 (0)