Bonjour,

J'ai presque finis mon programme pour un rail time laps photo. Et je bute sur un problème.

J'ai créer des incrémentations dans la boucle loop, elles sont bien affiché sur l'écran lcd mais pas prise en compte par le programme après le changement des valeurs avec les boutons.

Ma question est comment fixé rafraîchir les incrémentations dans :

int rpm;
int nombreDePas;
int tempsDePausePhoto;


???

Cordialement Alexandre.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <SerialLCD.h>
#include <SoftwareSerial.h> 
 
#define valeurMin 0
#define valeurMax 202
 
volatile int rpm;
int nombreDePas;
int tempsDePausePhoto;
int compteur;
 
#include <Stepper.h>
int enA  = 10;  // Enable pin 10 on Motor Control Shield
int enB  = 11;  // Enable pin 11 on Motor Control Shield
int dirA = 12;  // Direction pin dirA on Motor Control Shield
int dirB = 13;  // Direction pin dirB on Motor Control Shield
const int stepsPerRevolution = nombreDePas;
Stepper myStepper(stepsPerRevolution, dirA, dirB);
 
//Commande
int btnS1 = 7;  // Pin for button S1
int btnS2 = 6;  // Pin for button S2
int btnS3 = A5;  // Pin for button S3
int interupteur = 8;
int analogValue = 4;
 
//LCD
 
SerialLCD slcd(0,1);
 
void setup()
 
{
 
  pinMode(interupteur, OUTPUT);
  pinMode(btnS1, INPUT);
  pinMode(btnS2, INPUT);
  pinMode(btnS3, INPUT);
  pinMode(7,INPUT);
  digitalWrite(7, HIGH);
  pinMode(6,INPUT);
  digitalWrite(6, HIGH);
 
 
  slcd.begin();// set up :
 
  LCD();
 
 
  //LCD
 
    // set the speed at 60 rpm:
  myStepper.setSpeed(rpm);
  // Enable power to the motor
  pinMode(enA, OUTPUT);
  digitalWrite (enA, HIGH);
  pinMode(enB, OUTPUT);
  digitalWrite (enB, HIGH);
 
 
  //interupteur
 
  //btn1
 
}
 
void loop()
 
 
 
{
 
 
  if (digitalRead(interupteur)== HIGH){
 
    slcd.noBacklight();
    Moteurar();
    slcd.setCursor(8,0);
    if (compteur<valeurMax)++compteur,delay(150);
    LCD();
    delay(100);
    delay (tempsDePausePhoto*1000);
 
 
  }
 
  if (digitalRead(btnS1)==LOW)
  { 
    slcd.backlight();
    if (rpm<valeurMax)++rpm,delay(50);
    if(rpm > 201) { 
      rpm = 0;
    }    
    LCD();
  }
 
 
  if (digitalRead(btnS2)==LOW)
  { 
    slcd.backlight();
    if (tempsDePausePhoto<valeurMax)++tempsDePausePhoto,delay(50);
    if(tempsDePausePhoto > 201) { 
      tempsDePausePhoto = 0;
    }    
    LCD();
  }
 
 
  if (digitalRead(btnS3)==HIGH)
  { 
    slcd.backlight();
    if (nombreDePas<valeurMax)++nombreDePas,delay(150);
    if(nombreDePas > 201) { 
      nombreDePas = 0;
    }    
    LCD();
  }
}
 
 
void LCD(){
 
  slcd.setCursor(0,1);
  slcd.print("Rpm:");
  slcd.print(rpm,DEC);
  slcd.setCursor(8,1);
  slcd.print("PaP:");
  slcd.print(nombreDePas,DEC);
  slcd.setCursor(0,0);
  slcd.print("Tdp:");
  slcd.print(tempsDePausePhoto,DEC);
  slcd.setCursor(8,0);
  slcd.print("Cpt:");
  slcd.print(compteur,DEC);
  delay(100);
}
 
 
void Moteurav()   // Moteur Av
{
  myStepper.step(stepsPerRevolution);
}
void Moteurar()   // Moteur Ar
{
  myStepper.step(-stepsPerRevolution);
}