Pages: [1]   Go Down
Author Topic: Plusieurs thermocouples via MAX31855  (Read 948 times)
0 Members and 1 Guest are viewing this topic.
Lausanne
Offline Offline
Full Member
***
Karma: 0
Posts: 114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Voila j'utilise ce programme pour afficher la température d'un thermocouple via un MAX31855

Code:
// ***** INCLUDES *****
#include <MAX31855.h>

// ***** PIN DEFINITIONS *****
const unsigned char thermocoupleSO = 12;
const unsigned char thermocoupleCS = 10;
const unsigned char thermocoupleCLK = 13;

MAX31855 MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK);

void setup()
{
  Serial.begin(57600);
}

void loop()
{
  double temperature;
  
  // Retrieve thermocouple temperature in Degree Celsius
  temperature = MAX31855.readThermocouple(CELSIUS);
  Serial.print("Thermocouple temperature: ");
  Serial.print(temperature);
  Serial.println(" Degree Celsius");
    
  delay(1000);
}

Mais comment traiter et afficher plusieurs températures issues de plusieurs thermocouples, c'est à dire plusieurs MAX31855 ?
Logged

Ales
Offline Offline
Faraday Member
**
Karma: 29
Posts: 3174
Do or DIY
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
// ***** INCLUDES *****
#include <MAX31855.h>

// ***** PIN DEFINITIONS *****
const unsigned char thermocoupleSO = 12;
const unsigned char thermocoupleCS = 10;
const unsigned char thermocoupleCLK = 13;

const unsigned char thermocoupleSO_2 = xx;
const unsigned char thermocoupleCS_2= xx;
const unsigned char thermocoupleCLK_2 = xx;

MAX31855 MAX31855(thermocoupleSO, thermocoupleCS, thermocoupleCLK);
MAX31855 MAX31855_2(thermocoupleSO_2, thermocoupleCS_2, thermocoupleCLK_2);

void setup()
{
  Serial.begin(57600);
}

void loop()
{
  double temperature,temperature2;
  
  // Retrieve thermocouple temperature in Degree Celsius
  temperature = MAX31855.readThermocouple(CELSIUS);
temperature2 = MAX31855_2.readThermocouple(CELSIUS);
  Serial.print("Thermocouple temperature: ");
  Serial.print(temperature);
  Serial.println(" Degree Celsius");
  Serial.print("Thermocouple 2 temperature: ");
  Serial.print(temperature2);
  Serial.println(" Degree Celsius");
    
  delay(1000);
}

« Last Edit: March 05, 2013, 07:56:25 am by B@tto » Logged


Lausanne
Offline Offline
Full Member
***
Karma: 0
Posts: 114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

j'y avais bien pensé mais cela ne fonctionne pas, dès lors que j'essaie de renommer par ex : MAX31855_2, celui-ci n'est plus reconnu.
Logged

Ales
Offline Offline
Faraday Member
**
Karma: 29
Posts: 3174
Do or DIY
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"n'est plus reconnu" ==> c'est à dire ?
Logged


Lausanne
Offline Offline
Full Member
***
Karma: 0
Posts: 114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

cpp:17:1: error: 'MAX31855_2' does not name a type
Logged

Ales
Offline Offline
Faraday Member
**
Karma: 29
Posts: 3174
Do or DIY
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Avec le code que je viens de te donner ? Parce que ligne 17 c'est le Serial.begin ...
Logged


Lausanne
Offline Offline
Full Member
***
Karma: 0
Posts: 114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

non mais le num de ligne est faux, mais lorsque je change le nom du deuxième Max31855, celui ci devient noir et plus rouge, et quand j essaie de compiler j au ce message d erreur, essaie tu verras smiley-sad
Logged

Ales
Offline Offline
Faraday Member
**
Karma: 29
Posts: 3174
Do or DIY
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

J'ai pas testé mais y'a un exemple avec plusieurs CI dans la lib :
https://github.com/ryanjmclaughlin/MAX31855_Library/blob/master/examples/multi_max31855/multi_max31855.ino
Logged


Lausanne
Offline Offline
Full Member
***
Karma: 0
Posts: 114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perfect, ca fonctionne smiley

Par contre le sketch n'est pas compatible avec l'IDE ChipKIT  smiley-confuse
Logged

Pages: [1]   Go Up
Jump to: