IRTherm therm; // Create an IRTherm object to interact with throughout
int last_object_measurement = -1;
int last_field_measurement = -1;
int CT_x_offset = 0;
int CT_y_offset = 0;
int CT_x_width = 44;
int CT_y_height = 74;
bool setup_CT()
{
if (therm.begin() == false)
{ // Initialize thermal IR sensor
Serial.println("IR thermometer Failed");
return(false);
}
therm.setUnit(TEMP_F); // Set the library's units to Farenheit
therm.read();
return(true);
// therm.setEmissivity(0.98);
}
void CT_Reset()
{
last_object_measurement = -1;
last_field_measurement = -1;
}
void CT_Frame()
{
int box_top = CT_y_offset;
int box_left = CT_x_offset;
int box_width = CT_x_width;
int box_height = CT_y_height;
int title_x_offset = box_left + 1;
int title_y_offset = box_top + 2;
int field_x_offset = box_left + 1;
int field_y_offset = box_top + 24;
int object_x_offset = box_left + 1;
int object_y_offset = box_top + 48;
float field_measurement;
float object_measurement;
if ((last_field_measurement == -1) && (last_object_measurement == -1))
{
DrawScreenCompartment(box_left, box_top, box_width, box_height, COMMON_BLACK, COMMON_RED);
DrawScreenText(title_x_offset+4,title_y_offset,"MLX90",COMMON_WHITE,COMMON_BLACK);
DrawScreenText(title_x_offset+11,title_y_offset+12,"164",COMMON_WHITE,COMMON_BLACK);
DrawScreenText(field_x_offset,field_y_offset,"Field",COMMON_WHITE,COMMON_BLACK);
DrawScreenText(object_x_offset,object_y_offset,"Object",COMMON_WHITE,COMMON_BLACK);
}
therm.read();
field_measurement = therm.ambient();
delay(20);
object_measurement = therm.object();
if ( last_field_measurement != field_measurement)
{
DrawScreenText(field_x_offset,field_y_offset+12," ",COMMON_WHITE,COMMON_BLACK);
DrawScreenText(field_x_offset,field_y_offset+12,String(field_measurement, 2),COMMON_WHITE,COMMON_BLACK);
}
if ( last_object_measurement != object_measurement)
{
DrawScreenText(object_x_offset,object_y_offset+12," ",COMMON_WHITE,COMMON_BLACK);
DrawScreenText(object_x_offset,object_y_offset+12,String(object_measurement, 2),COMMON_WHITE,COMMON_BLACK);
}
last_field_measurement = field_measurement;
last_object_measurement = object_measurement;
}
Pseudo-Medical_Monitor_Code#Custom_Includes