Hi, I am currently doing a project for an Engineering Class of ours. We are using a Arduino MEGA and have 5 different data points that we want to print these are the; data from the Oximeter, Thermal Cam, Load Cell, Ultrasonic Sensor and our BMI. Now, I want to store these in an array to print thru our thermal printer but, our problem is the data from our Oximeter takes atleast 5 seconds to stabilise/calibrate and our test subjects will not take these tests simultaneously and will take them one by one and We only want it to serial print when a person/subject approaches the machine and when they finish the relay is for a UVC light to sterilize the surface they touched. Now, I've used arduino before but all of those projects have taken data from sensors simultaneously. Any idea on how to store these data into an array and only take the most recent one to print through our thermal printer? Is this even possible in an Arduino MEGA?
Here is our Code:
void loop() {
//read all the pixels
amg.readPixels(pixels);
float maxx = -99.9;
for (int i = 0; i < AMG88xx_PIXEL_ARRAY_SIZE; i++) {
uint8_t colorIndex = map(pixels[i], MINTEMP, MAXTEMP, 0, 255);
colorIndex = constrain(colorIndex, 0, 255);
//draw the pixels!
if (pixels[i] > maxx) {
maxx = pixels[i];
}
}
scale.set_scale(calibration_factor); //Adjust to this calibration factor
uint8_t num_samples = MAX32664.readSamples();
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distanceCm = duration * 0.034 / 2;
//distanceInch = duration*0.0133/2;
b = 213.36 - distanceCm;
int c = b / 100;
//bmi
int weight = (scale.get_units(), 3);
int height = (c * c);
int bmi = weight / height;
while (ir == HIGH) {
if (num_samples) {
//Oximeter
Serial.print(" sys = " + String(MAX32664.max32664Output.sys));
Serial.print(" dia = " + String(MAX32664.max32664Output.dia));
Serial.print(" hr = " + String(MAX32664.max32664Output.hr));
Serial.print(" spo2 = " + String(MAX32664.max32664Output.spo2));
Serial.print(" , ");
// Temp
Serial.print(" Temp(C): " + String(maxx));
Serial.print(" , ");
//Weight
Serial.print(" Weight(kg): " + String(weight)); //weight
Serial.print(" , ");
//Height
Serial.print(" Height(cm): " + String(b)); // Heights
Serial.print(" , ");
//BMI
Serial.print("BMI: " + String(bmi));
Serial.print(" , ");
if (bmi <= 18.4) {
Serial.println("Underweight");
}
else if (bmi <= 24.9) {
Serial.println(("Healthy"));
}
else if (bmi <= 29.9) {
Serial.println(("Overweight"));
}
else if (bmi <= 34.9) {
Serial.println(("Severely Overweight"));
}
else if (bmi <= 39.9) {
Serial.println(("Obese"));
}
else {
Serial.println("Severely Obese");
}
delay(1000);
}
break
}
else {
digitalWrite(relay, HIGH);
delay(30000);
}
}
}