j ais trouver !!! il fallait m inscrire et une sorirée de recherche en plus , j ais intégrer mon thermocouple .
#include <LiquidCrystal.h>
#include <max6675.h>
#include <Wire.h>
// thermocouple max6675
int thermoDO = 5;
int thermoCS = 6;
int thermoCLK = 4;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int vccPin = 13;
int gndPin = 3;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
byte custchar[8][8] = {
{
B11111,
B11111,
B11111,
B00000,
B00000,
B00000,
B00000,
B00000
}, {
B00000,
B00000,
B00000,
B00000,
B00000,
B11111,
B11111,
B11111
}, {
B11111,
B11111,
B11111,
B00000,
B00000,
B11111,
B11111,
B11111
}, {
B00000,
B00000,
B00000,
B00000,
B00000,
B01110,
B01110,
B01110
}, {
B00000,
B00000,
B00000,
B01110,
B01110,
B01110,
B00000,
B00000
}, {
B00000,
B00100,
B01010,
B10001,
B01010,
B00100,
B00000,
B00000
}, {
B00000,
B11011,
B11011,
B00000,
B00100,
B10001,
B01010,
B00100
}, {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000
}
};
byte bignums[10][2][3] = {
{
{255, 0, 255},
{255, 1, 255}
},{
{0, 255, 254},
{1, 255, 1}
},{
{2, 2, 255},
{255, 1, 1}
},{
{0, 2, 255},
{1, 1, 255}
},{
{255, 1, 255},
{254, 254, 255}
},{
{255, 2, 2},
{1, 1, 255}
},{
{255, 2, 2},
{255, 1, 255}
},{
{0, 0, 255},
{254, 255, 254}
},{
{255, 2, 255},
{255, 1, 255}
},{
{255, 2, 255},
{254, 254, 255}
}
};
void loadchars() {
lcd.command(64);
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
lcd.write(custchar[i][j]);
lcd.home();
}
//This function prints an integer between o and 999 in a big font at the left of the display
// Argument is a byte array Digits[# of digits, Digit 1, Digit 2, Digit 3]
// Nothing is returned.
// Numbers outside of the limits of this function will print an error screen.
void printCustom (int x)
{
byte digits[4];
if (x>99)
{
digits[0] = 3;
digits[1] = x/100;
digits[2] = (x%100)/10;
digits[3] = (x%100)%10;
}
if ((x>9) && (x<=99))
{
digits[0] = 3;
digits[1] = 0;
digits[2] = x/10;
digits[3] = x%10;
}
if (x<=9)
{
digits[0] = 3;
digits[1] = 0;
digits[2] = 0;
digits[3] = x%10;
}
if (digits[0] > 3){
lcd.print("PRINT ERROR");
return;
}
for(int e = 1; e < 2; e++)
{
if(digits[e] > 9){
lcd.print("PRINT ERROR");
return;
}
}
for(int digitLoc= 0;digitLoc<digits[0];digitLoc++)
{
for (int i = 0; i <2; i++)
{
lcd.setCursor(digitLoc*4,i);
for(int j = 0; j < 3; j++)
{
lcd.write(bignums[digits[(digitLoc+1)]][i][j]);
}
lcd.write(254);
}
}
}
//Setup the lcd screen and load the custom characters
void setup() {
loadchars();
lcd.begin(16,2);
Serial.begin(9600);
// thermocouple max6675
pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
}
void loop() {
lcd.setCursor(0,0);
printCustom(thermocouple.readCelsius());
Serial.println(thermocouple.readCelsius());//ecrit termocouple avec printCustom (big font)
lcd.setCursor(11,0);
lcd.write(5); //custom 5 signe degres
lcd.setCursor(13,1);
lcd.write("EGT");
delay(500);
}