Problème avec LCD display + capteur de température

pguiot
dim, 12/13/2015 - 15:47
Bonjour,
Si quelqu'un peut m'aider, voici mon problème :
Le materiel : Arduino Uno + TMP36 + HD44780
Testé individuellement :
Soit le TMP36 vers l'interface série, je reçois un résultat correct : la température courante.
Soit le HD44780 : il affiche texte/ variable demandé dans mon programme
Testés ensemble :
La température du TMP36 vers le HD44780 : le LCD display affiche des températures erronées !
Le montage est inspiré de l'URL suivante :
https://axelauvinen.wordpress.com/2014/02/09/arduino-lcd-temperature-met...
D'avance, merci pour vos tuyaux ...
Alex
lun, 12/14/2015 - 14:46
Si les tests unitaires fonctionnent, mais pas les tests d'intégration, alors c'est qu'il a un problème de soft dans l'échange des données.
Peux-tu nous faire voir le code?
pguiot
lun, 12/14/2015 - 20:49
Voici :
//TMP36 Pin Variables
int sensorPin = 0;
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Temperature: ");
}
void loop() {
int reading = analogRead(sensorPin);
// Serial.println(reading) ;
// converting that reading to voltage
float voltage = (reading * 5.0)/1024.0 ;
// print out the voltage
Serial.print(voltage); Serial.println(" volts");
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
// Serial.println(temperatureC); // Serial.println(" degrees C");
lcd.setCursor(0, 1);
lcd.clear();
lcd.print(temperatureC);
Serial.println(temperatureC);
delay(3000);
}
Christopher
dim, 01/10/2016 - 21:08
Bonjour j'aimerai utiliser un lcd 16x02 avec un I2C mais je n'arrive a rien j'ai trouver des code sur internet mais mon lcd n'affiche absolument pas ce que je veux, il affiche " i]Ymi%MI9m"
le code est celui la :
/*-----( Import needed libraries )-----*/
#include <Wire.h> // Comes with Arduino IDE
// Get the LCD I2C Library here:
// www.4tronix.co.uk/arduino/sketches/LiquidCrystal_V1.2.1.zip
// Move any other LCD libraries to another folder or delete them
// See Library "Docs" folder for possible commands etc.
#include <LiquidCrystal_I2C.h>
/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 16 chars 2 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x40, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
/*-----( Declare Variables )-----*/
//NONE
void setup() /*----( SETUP: RUNS ONCE )----*/
{
Serial.begin(9600); // Used to type in characters
lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight
// ------- Quick 3 blinks of backlight -------------
for(int i = 0; i< 3; i++)
{
lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
}
lcd.backlight(); // finish with backlight on
//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("Hello, world!");
delay(1000);
lcd.setCursor(0,1);
lcd.print("Coucou"); // Print text on second line
delay(8000);
// Wait and then tell user they can start the Serial Monitor and type in characters to
// Display. (Set Serial Monitor option to "No Line Ending")
/* lcd.clear();
lcd.setCursor(0,0); //Start at character 0 on line 0
lcd.print("Use Serial Mon");
lcd.setCursor(0,1);
lcd.print("Type to display"); */
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
//lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
//lcd.write(Serial.read());
}
}
}
}/* --(end main loop )-- */
/* ( THE END ) */
Alex
dim, 01/10/2016 - 21:17
Est-ce qu'il fonctionne en faisant exactement ça? http://4tronix.co.uk/arduino/I2C_LCD_Module.php
Christopher
dim, 01/10/2016 - 21:33
Non justement, il m'affiche des caractères bizarre
mais il faut pas d'abord trouver une adresse du genre 0x27 ?
mon arduino n'est pas un officiel l'erreur peut elle venir de la ?
Christopher
dim, 01/10/2016 - 21:44
si je suis exactement le code le lcd ne m'affiche rien
mais si je change l'adresse sa m'affiche les caractere bizzare