Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem function use an object before object declaration #111

Open
thierry7100 opened this issue Apr 13, 2018 · 0 comments
Open

Problem function use an object before object declaration #111

thierry7100 opened this issue Apr 13, 2018 · 0 comments

Comments

@thierry7100
Copy link

Hi
In some cases with functions, I have a problem because the functions will refer to an object before the object declaration.
Here is an example of the generated code: The function "AfficheHeure" will use the object lcd before its declaration, this will lead to compiler error within tthe Arduino IDE.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

int Heure;
int Minute;
int Seconde;
int Jour;
int Mois;
int Annee;
unsigned long MemSeconde;

// Décrire cette fonction
void AfficheHeure() {
if (Heure < 10) {
lcd.setCursor(3,0);
lcd.print("0");
lcd.setCursor(4,0);
lcd.print(Heure);

} else {
lcd.setCursor(3,0);
lcd.print(Heure);

}
lcd.setCursor(5,0);
lcd.print(":");
if (Minute < 10) {
lcd.setCursor(6,0);
lcd.print("0");
lcd.setCursor(7,0);
lcd.print(Minute);

} else {
lcd.setCursor(6,0);
lcd.print(Minute);

}
lcd.setCursor(8,0);
lcd.print(":");
if (Seconde < 10) {
lcd.setCursor(9,0);
lcd.print("0");
lcd.setCursor(10,0);
lcd.print(Seconde);

} else {
lcd.setCursor(9,0);
lcd.print(Seconde);

}
if (Jour < 10) {
lcd.setCursor(2,1);
lcd.print("0");
lcd.setCursor(3,1);
lcd.print(Jour);

} else {
lcd.setCursor(2,1);
lcd.print(Jour);

}
lcd.setCursor(4,1);
lcd.print("/");
if (Mois < 10) {
lcd.setCursor(5,1);
lcd.print("0");
lcd.setCursor(6,1);
lcd.print(Mois);

} else {
lcd.setCursor(5,1);
lcd.print(Mois);

}
lcd.setCursor(7,1);
lcd.print("/");
lcd.setCursor(8,1);
lcd.print(Annee);
}

LiquidCrystal_I2C lcd(0x3F, 16, 2);
// Décrire cette fonction
void MiseAJourHeure() {_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant