Merging codes togther

Hello guys please help me for contact two codes to gather please

first code of
temperature :thermometer:
And
glucose.
And
Screen also


:thermometer: Code of Temperature :point_down:

#include <Adafruit_MLX90614.h>
Adafruit_MLX90614 mlx = Adafruit_MLX90614();
void setup() { Serial.begin(9600);

Serial.println("Adafruit MLX90614 test");

if (!mlx.begin()) {
Serial.println("Error connecting to MLX sensor. Check wiring.");
while (1);
};
}
void loop() {
Serial.print("C = "); Serial.print(mlx.readObjectTempC()); Serial.println("C");
delay(500);}


Code of glucose :point_down:

#include <Adafruit_LiquidCrystal.h>

const int analogInpin0=0;
const int analogInpin1=1;

float sensor_value1=0;
float sensor_value2=0;

int max_1=0;
int max_2=0;

int indice_max1=0;
int indice_max2=0;

int tab1[90];
int tab2[90];

int j1;
int j2;

int i1;
int i2;

// Alcohol
float MAXG1=0;
float X1=0;

// Propane
float MAXG2=0;
float X2=0;

//Result
float Y=0;

// Coeffecients safety
const float a=0.668;
const float b=0.014;
const float c=51.784;

// Coeffecients 2 des trois capteurs negligeant acetone
//const float a=0.457;
//const float b=0.014;
//const float c=54.510;

// include the library code:
#include <Adafruit_LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
Adafruit_LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
Serial.begin(9600);
lcd.begin(16, 2);

   while (millis() < 3000)

{
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
delay(1000);
digitalWrite(13,HIGH);
if(digitalRead(13==HIGH))

{

//Read the Alcohol max value

for(i1=0;i1<90;i1++)
{
tab1[i1]=analogRead(analogInpin0);
Serial.print(i1);
Serial.print(" : ");
Serial.println(tab1[i1]);

  if(tab1[i1]>max_1)
                    {
                     max_1=tab1[i1];
                     indice_max1 = i1;
                    }
}

  Serial.print("max1=");
  Serial.println(max_1);  
  Serial.println("indice max1");
  Serial.print(indice_max1);
  Serial.print(" : ");
  Serial.println(max_1);

// Read the Propane max value

for(i2=0;i2<90;i2++)
{
tab2[i2]=analogRead(analogInpin1);
Serial.print(i2);
Serial.print(" : ");
Serial.println(tab2[i2]);

 if(tab2[i2]>max_2)
                      {
                       max_2=tab2[i2];
                       indice_max2 = i2; 
                      }
}

Serial.print("max2=");
Serial.println(max_2);
Serial.println("indice max2");
Serial.print(indice_max2);
Serial.print(" : ");
Serial.println(max_2);

}

}

MAXG1=max_1;
MAXG2=max_2;

//Alcohol
X1=(MAXG1*180)/1023;
Serial.print("X1=");
Serial.print(X1);
Serial.println("ppm");

// Propane
X2=(MAXG2*1000)/1023;
Serial.print("X2=");
Serial.print(X2);
Serial.println("ppm");

Y=aX1+bX2+c;
Serial.print("Y=");
Serial.print(Y);
delay(5000);
lcd.print("Glycemia : ");
lcd.setCursor(0, 1);
lcd.print(Y);
lcd.print(" mg/dl");
}

void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
// print the number of seconds since reset:
}


And here code of screen TPT

Code of screen :point_down::point_down:

#include <Adafruit_GFX.h> // Core graphics library
#include <MCUFRIEND_kbv.h> // Hardware-specific library
MCUFRIEND_kbv tft;

#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSans12pt7b.h>
#include <Fonts/FreeSerif12pt7b.h>

#include <FreeDefaultFonts.h>

#define BLACK 0x0000
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF
#define GREY 0x8410

void setup(void)
{
Serial.begin(9600);
uint16_t ID = tft.readID();

if (ID == 0xD3D3) ID = 0x9481; //force ID if write-only display
tft.begin(ID);
tft.setRotation(1);

}

void loop(void)
{
tft.fillScreen(BLACK);
showmsgXY(20, 10, 3, NULL, "gulcose");
showmsgXY(300, 10, 3, NULL, "valu");
showmsgXY(20, 60, 3, NULL, "sys");
showmsgXY(300, 60, 3,NULL, "valu");
showmsgXY(20, 110, 3, NULL, "dis");
showmsgXY(300, 100, 3,NULL, "valu");
showmsgXY(20, 160, 3,NULL, "o2");
showmsgXY(300, 160, 3, NULL, "valu");
showmsgXY(20, 210, 3, NULL, "heart rate");
showmsgXY(300, 210, 3, NULL, "valu");
showmsgXY(20, 260, 3, NULL, "temprut");
showmsgXY(300, 260, 3, NULL, "valu");
}

void showmsgXY(int x, int y, int sz, const GFXfont *f, const char *msg)
{
int16_t x1, y1;
uint16_t wid, ht;
// tft.drawFastHLine(0, y, tft.width(), WHITE);
tft.setFont(f);
tft.setCursor(x, y);
tft.setTextColor(GREEN);
tft.setTextSize(sz);
tft.print(msg);
delay(1000);
}


And here my trying with screen I know there is error
:disappointed: but that why I ask for help please

Coding try with screen :point_down::point_down::point_down:

//scrren
#include <Adafruit_GFX.h> // Core graphics library
#include <MCUFRIEND_kbv.h> // Hardware-specific library
MCUFRIEND_kbv tft;

#include <Fonts/FreeSans9pt7b.h>
#include <Fonts/FreeSans12pt7b.h>
#include <Fonts/FreeSerif12pt7b.h>

#include <FreeDefaultFonts.h>

#define BLACK 0x0000
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF
#define GREY 0x8410

//gluu
const int analogInpin0=0;
const int analogInpin1=1;

float sensor_value1=0;
float sensor_value2=0;

int max_1=0;
int max_2=0;

int indice_max1=0;
int indice_max2=0;

int tab1[90];
int tab2[90];

int j1;
int j2;

int i1;
int i2;

// Alcohol
float MAXG1=0;
float X1=0;

// Propane
float MAXG2=0;
float X2=0;

//Result
float Y=0;

// Coeffecients safety
const float a=0.668;
const float b=0.014;
const float c=51.784;

// Coeffecients 2 des trois capteurs negligeant acetone
//const float a=0.457;
//const float b=0.014;
//const float c=54.510;

//temp

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

void setup(void)
{
Serial.begin(9600);
uint16_t ID = tft.readID();

if (ID == 0xD3D3) ID = 0x9481; //force ID if write-only display
tft.begin(ID);
tft.setRotation(1);

//glu

   while (millis() < 3000)

{
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
delay(1000);
digitalWrite(13,HIGH);
if(digitalRead(13==HIGH))

{

//Read the Alcohol max value

for(i1=0;i1<90;i1++)
{
tab1[i1]=analogRead(analogInpin0);
Serial.print(i1);
Serial.print(" : ");
Serial.println(tab1[i1]);

  if(tab1[i1]>max_1)
                    {
                     max_1=tab1[i1];
                     indice_max1 = i1;
                    }
}

  Serial.print("max1=");
  Serial.println(max_1);  
  Serial.println("indice max1");
  Serial.print(indice_max1);
  Serial.print(" : ");
  Serial.println(max_1);

// Read the Propane max value

for(i2=0;i2<90;i2++)
{
tab2[i2]=analogRead(analogInpin1);
Serial.print(i2);
Serial.print(" : ");
Serial.println(tab2[i2]);

 if(tab2[i2]>max_2)
                      {
                       max_2=tab2[i2];
                       indice_max2 = i2; 
                      }
}

Serial.print("max2=");
Serial.println(max_2);
Serial.println("indice max2");
Serial.print(indice_max2);
Serial.print(" : ");
Serial.println(max_2);

}

}

MAXG1=max_1;
MAXG2=max_2;

//Alcohol
X1=(MAXG1*180)/1023;
Serial.print("X1=");
Serial.print(X1);
Serial.println("ppm");

// Propane
X2=(MAXG2*1000)/1023;
Serial.print("X2=");
Serial.print(X2);
Serial.println("ppm");

Y=aX1+bX2+c;
Serial.print("Y=");
Serial.print(Y);
delay(5000);
lcd.print("Glycemia:");
lcd.setCursor(0, 1);
lcd.print(Y);
lcd.print(" mg/dl");
}

// temp

Adafruit_MLX90614 mlx = Adafruit_MLX90614();

Serial.println("Adafruit MLX90614 test");

if (!mlx.begin()) {
Serial.println("Error connecting to MLX sensor. Check wiring.");
while (1);
};
}

void loop(void)
{
tft.fillScreen(BLACK);
showmsgXY(20, 10, 3, NULL, "gulcose");
showmsgXY(300, 10, 3, NULL, "Y");
showmsgXY(20, 60, 3, NULL, "sys");
showmsgXY(300, 60, 3,NULL, "valu");
showmsgXY(20, 110, 3, NULL, "dis");
showmsgXY(300, 100, 3,NULL, "valu");
showmsgXY(20, 160, 3,NULL, "o2");
showmsgXY(300, 160, 3, NULL, "valu");
showmsgXY(20, 210, 3, NULL, "heart rate");
showmsgXY(300, 210, 3, NULL, "valu");
showmsgXY(20, 260, 3, NULL, "temprut");
showmsgXY(300, 260, 3, NULL, "valu");
}

void showmsgXY(int x, int y, int sz, const GFXfont *f, const char *msg)
{
int16_t x1, y1;
uint16_t wid, ht;
// tft.drawFastHLine(0, y, tft.width(), WHITE);
tft.setFont(f);
tft.setCursor(x, y);
tft.setTextColor(GREEN);
tft.setTextSize(sz);
tft.print(msg);
delay(1000);
}

//glcuu

{
set the cursor to column 0, line 1
(note: line 1 is the second row, since counting begins with 0):
print the number of seconds since reset:
}

//temp

Serial.print("C = "); Serial.print(mlx.readObjectTempC()); Serial.println("C");
delay(500);}

Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

Combine codes.
Merging codes.

Please edit your post to add code tags.

In order to merge program codes, you have to first go through each program and make sure that you understand what each line of the program does.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.