texte defilant

est-il possible, de faire défiler du texte dans l'arduino ???
Si oui quoi ajouter dans la ligne ci dessous ?

void setup()
{
// variables initialization
ulEndTime = 0;
ulCurrentTime = 0;
ulPreviousTime = 0;
ulDuration = 0;
ulUserAction = 0;
ulPreviousRemainingTime = 0;
bTimerIsRunning = false;

// display initialization
lcd.init();
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(" choisir duree");

Merci

Bonjour F8FFP,

Avec la librairie LiquidCrystalScroll ? ^.^
->

void loop() {
  // scroll 13 positions (string length) to the left
  // to move it offscreen left:
  for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayLeft();
    // wait a bit:
    delay(150);
  }

  // scroll 29 positions (string length + display length) to the right
  // to move it offscreen right:
  for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
    // scroll one position right:
    lcd.scrollDisplayRight();
    // wait a bit:
    delay(150);
  }
 
    // scroll 16 positions (display length + string length) to the left
    // to move it back to center:
  for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
    // scroll one position left:
    lcd.scrollDisplayLeft();
    // wait a bit:
    delay(150);
  }
 
  // delay at the end of the full loop:
  delay(1000);

}

Mon projet:
minuterie pour la cuisine avec un message d'accueil défilant /le minuteur/ et faire clignoter une LED toutes les 15S
dès la mise en route d'un programme de cuisson/ et insérer un buzzer pour signaler la fin du programme

j'ai entré ceci pour voir déjà côté texte dès la mise en route de l'ARDUINO:

#include <LCD4Bit_mod.h> // librairie à inclure pour prendre en charge l'afficheur LCD

LCD4Bit_mod lcd = LCD4Bit_mod(2); // déclaration d'un objet de type LCD
void setup() // le setup s'effectue une seule fois à la mise sous tension
{
lcd.init(); // mise en marche du LCD
lcd.clear(); // on efface l'écran des fois qu'il reste du chni
lcd.printIn("Bonjour");
delay(5000); // attendre 5000 millisecondes
lcd.clear(); // on efface l'écran à la fin
}

void loop() // une fois le setup terminé, loop s'éffectue en boucle sans fin
{
// ne fait rien
}

boucle void () {
/ / 13 positions de défilement (longueur de la chaîne) vers la gauche
/ / Pour déplacer hors de l'écran qu'il a laissé:
pour (positionCounter int = 0; positionCounter <13; positionCounter + +) {
/ / Faire défiler d'une position de gauche:
lcd.scrollDisplayLeft ();
/ / Attendre un peu:
retard (150);
}

/ / Faire défiler 29 postes (longueur de la chaîne + longueur d'affichage) à droite
/ / Pour déplacer ce droit hors de l'écran:
pour (positionCounter int = 0; positionCounter <29; positionCounter + +) {
/ / Faire défiler une bonne position:
lcd.scrollDisplayRight ();
/ / Attendre un peu:
retard (150);
}

/ / 16 positions de défilement (longueur d'affichage + longueur de chaîne) à gauche
/ / Pour le ramener au centre:
pour (positionCounter int = 0; positionCounter <16; positionCounter + +) {
/ / Faire défiler d'une position de gauche:
lcd.scrollDisplayLeft ();
/ / Attendre un peu:
retard (150);
}

/ / Délai à la fin de la boucle complète:
retard (1000);

}

Il me donne ce message d'erreur
conversion before 'void'
et cette ligne est souligné

/ / 13 positions de défilement (longueur de la chaîne) vers la gauche

Je souhaite faire défiler le message d'accueil

Je précise aussi que je suis dans ma toute première configuration avec mon premier ARDUINO.

Ca bug parce qu'il y a un espace entre les deux /, et il ne reconnait pas une ligne de commentaire. Remplace les "/ /" par "//"

Merci beaucoup !

Mais je comprends pas comment rajouter une fonction comme par exemple un petit piezo pour envoyer un signal sonore dès le temps de cuisson terminé
ou l'ajout d'une led qui clignote dès le le programme et lancé.

Je trouve plusieurs code selon ce que je souhaite ajouter à l'Arduino, mais voilà pour les ajouter dans le fichier de base de la minuterie
sa se complique pour moi. j'ai toujours des erreurs d'indiquées.

J'ai donc fais comme ceci

#include <LCD4Bit_mod.h>
#include <stdio.h>

#define SMALLSTEP 1
#define BIGSTEP 10
#define MINCONV 60000
#define NUM_KEYS 5

LCD4Bit_mod lcd = LCD4Bit_mod(2);
bool bTimerIsRunning;
unsigned long ulDuration;
unsigned long ulUserAction;
unsigned long ulCurrentTime;
unsigned long ulPreviousTime;
unsigned long ulEndTime;
unsigned long ulPreviousRemainingTime;
int adc_key_val[5] ={30, 150, 360, 535, 760 };
int adc_key_in;
int key=-1;
int oldkey=-1;

void setup()
{
// variables initialization
ulEndTime = 0;
ulCurrentTime = 0;
ulPreviousTime = 0;
ulDuration = 0;
ulUserAction = 0;
ulPreviousRemainingTime = 0;
bTimerIsRunning = false;

// display initialization
lcd.init();
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(" Choisir duree ");
}
void loop() { error: 'void loop()' previously defined here
// scroll 13 positions (string length) to the left
// to move it offscreen left:
for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
// scroll one position left:
LCD4Bit_mod lcd = LCD4Bit_mod(2);
// wait a bit:
delay(150);
}

// scroll 29 positions (string length + display length) to the right
// to move it offscreen right:
for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
// scroll one position right:
LCD4Bit_mod lcd = LCD4Bit_mod(2);
// wait a bit:
delay(150);
}

// scroll 16 positions (display length + string length) to the left
// to move it back to center:
for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
// scroll one position left:
LCD4Bit_mod lcd = LCD4Bit_mod(2);
// wait a bit:
delay(150);
}

// delay at the end of the full loop:
delay(1000);

}
void loop() {
//récup valeur button
delay(80);
ulUserAction = GetButtonValue(0);
switch (ulUserAction)
{
case 0 : // right button : +10min
ulDuration += BIGSTEP;
DisplayRemainingTime(ulDuration);
break;
case 1 : // up button : +1min
ulDuration += SMALLSTEP;
DisplayRemainingTime(ulDuration);
break;
case 2 : // down button : -1min
if (ulDuration >= 1)
{
ulDuration -= SMALLSTEP;
}
else
{
ulDuration = 0;
}
DisplayRemainingTime(ulDuration);
break;
case 3 : // left button : -10min
if (ulDuration >= BIGSTEP)
{
ulDuration -= BIGSTEP;
}
else
{
ulDuration = 0;
}
DisplayRemainingTime(ulDuration);
break;
case 4 : // select button
if (ulDuration > 0)
{
bTimerIsRunning = true;
ulEndTime = millis() + (ulDuration * MINCONV);
}
break;
}
delay(80);
// no user action, process countdown if running
if (bTimerIsRunning)
{
ulCurrentTime = millis();
if (ulCurrentTime-ulPreviousTime > 1000)
{
if (ulEndTime < ulCurrentTime)
{
// countdown ended
DisplayEnd();
}
else
{
// countdown still going
DisplayRemainingTime((ulEndTime-ulCurrentTime)/MINCONV);
}
ulPreviousTime = ulCurrentTime;
}
}
}

void DisplayRemainingTime(unsigned long ulRemainingTime)
{
if (ulPreviousRemainingTime != ulRemainingTime)
{
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn("Duree restante:");

char buffer[16];
sprintf(buffer,"%d minute(s)", ulRemainingTime); // %d pour les variables décimale. (int)temp = 3 et temp1 = 14
lcd.cursorTo(2, 0);
lcd.printIn(buffer);
ulPreviousRemainingTime = ulRemainingTime;
}
}

void DisplayEnd()
{
lcd.clear();
lcd.cursorTo(1, 0);
lcd.printIn(" Duree atteinte");
lcd.cursorTo(2, 0);
lcd.printIn("Appui sur RESET");
bTimerIsRunning = false;
ulCurrentTime = 0;
ulEndTime = 0;
}

int GetButtonValue(int iAnalogSensor)
{
adc_key_in = analogRead(iAnalogSensor);
//digitalWrite(13, HIGH);
key = get_key(adc_key_in); // convert into key press

if (key != oldkey) // if keypress is detected
{
delay(50); // wait for debounce time
adc_key_in = analogRead(iAnalogSensor); // read the value from the sensor
key = get_key(adc_key_in); // convert into key press
if (key != oldkey)
{
oldkey = key;
}
}
}

// Convert ADC value to key number
int get_key(unsigned int input)
{
int k;
for (k = 0; k < NUM_KEYS; k++)
{
if (input < adc_key_val[k])
{
return k;
}
}
if (k >= NUM_KEYS)
{
k = -1; // No valid key pressed
}
return k;
}

Bonjour,

tu as ce message car tu as 2 fonctions loop dans ton code, la fonction loop correspond à la fonction principale d'un programme Arduino (c'est l'équivalent de la fonction main en C standard) il ne peut y en avoir qu'une.

Serge

Comme je débute avec Arduino, je ne le savais pas.

Que me propose tu à mettre sur cette ligne ???

Si tu n'as aucune connaissance en programmation C/C++ et que tu débutes avec Arduino, je te conseil d'abandonner (temporairement) ton projet. Il existe plusieurs kits pour débutant qui te permettrons de faire tes gammes progressivement avec des projets plus simple.
Par exemple :

Serge

Bonjour à tous,

Nous avons un projet qui a pour but de représenter le panneau d'affichage des trains en gare. Ainsi sur une ligne on veut afficher la voie, l'horaire, le numéro et la destination d'un train.
Pour cela, on a besoin d'afficher un alphabet d'effilant. Nous avons le code suivant qui marche qui sert à faire défiler une lettre. Malheureusement nous le comprenons pas c'est-à-dire qu'on serrait incapable de l'expliquer. Pourriez-vous nous l'expliquer?
Merci :slight_smile:

#define EXTRACT(lettre,decalageInitial,numBit) (((lettre>>decalageInitial) & (1<<numBit)) >>numBit)

/*
couleur : BLACK, RED, GREEN, ORANGE
affiche une lettre passée en paramètre à la position désirée
*/
void afficherLettre(T_Lettre lettre, byte x, byte y, byte couleur)
{
int l,c,val;

for(l=0;l<5;l++)
for(c=0;c<3;c++)
{
if (l==0) val= EXTRACT(lettre[0],4,2-c);
if (l==1) val= EXTRACT(lettre[0],1,2-c);
if (l==2)
if (c==0) val= EXTRACT(lettre[0],0,0);
else val = EXTRACT(lettre[1],6,2-c);

if (l==3) val= EXTRACT(lettre[1],3,2-c);
if (l==4) val= EXTRACT(lettre[1],0,2-c);

if (val)
ht1632_plot(x+c, y+l, couleur);
else
ht1632_plot(x+c, y+l, BLACK);
}
}

@lesblondesdelinfo
Merci d'effacer ce post et de créer un sujet séparé.