Bonjour,
je vient vers vous pour m'aider a avoir des explications et peut être la solution pour gérer la mémoire de mon Arduino, pour cela je pose quelque question.
1- le fait d'utiliser Serial.print utilise t-il beaucoup de mémoire et influence t-il mon timer millis?
2- je met mon programme qui fonctionne, mais dès que je remet le dernier serial print mon programme ne fonctionne plus.
3- si c'est juste un problème de mémoire y a t il un moyen de réduire la mémoire ( j'ai encore beaucoup de code pour finir mon programme)
merci d'avance pour votre aide précieux.
#define ENTREE_ANALOGIQUE 1
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
#include <Fonts/FreeMono9pt7b.h> // Normal (en 9, 12, 18, et 24 pts)
#define nombreDePixelsEnLargeur 128 // Taille de l'écran OLED, en pixel, au niveau de sa largeur
#define nombreDePixelsEnHauteur 64 // Taille de l'écran OLED, en pixel, au niveau de sa hauteur
#define brocheResetOLED -1 // Reset de l'OLED partagé avec l'Arduino (d'où la valeur à -1, et non un numéro de pin)
#define adresseI2CecranOLED 0x3C // Adresse de "mon" écran OLED sur le bus i2c (généralement égal à 0x3C ou 0x3D)
#define IN1 10
#define IN2 5
Adafruit_SSD1306 ecranOLED(nombreDePixelsEnLargeur, nombreDePixelsEnHauteur, &Wire, brocheResetOLED); // Le "Wire" indique qu'on travaille en I2C
volatile int bpMAV = 0; //ON OFF
volatile int bpMAR = 0; //ON OFF
volatile int bpFINCOURSE = 0; //fin de course du système
volatile int intPORTE = 0; // INTERRUPTEUR port
volatile int intCONTACTCLEF = 0; // INTERRUPTEUR clé
volatile int intAUTO = 0; // INTERRUPTEUR manuel/Auto
int PWM1 = 204;// rapport cyclique 80%
int PWM2 = 50; // rapport cyclique 20%
int PWM3 = 127; // rapport cyclique 50%
int PWM4 = 50; // rapport cyclique 20%
int crono3 = 1300;
int cronall2 = 1000;
unsigned long chrono_marche_avant;
int marche_avant_active = 0;
unsigned long delai_marche_avant;
unsigned long chrono_marche_arriere;
int marche_arriere_active = 0;
unsigned long delai_marche_arriere;
int obstacle_marche_avant = 0;
int obstacle_marche_arriere = 0;
unsigned long chrono_porte_ouverte ;
int porte_ouverte_active = 0;
unsigned long delai_porte_ouverte;
int marche_arriere_obstacle_active = 0;
unsigned long delai_marche_arriere_obstacle;
unsigned long chrono_marche_arriere_obstacle;
int marche_avant_obstacle_active = 0;
unsigned long delai_marche_avant_obstacle;
unsigned long chrono_marche_avant_obstacle;
float SensorRead = analogRead(A2) * 5.0 / 1023.0; //We read the sensor output
int flag = 0;
int flag1 = 0;
const unsigned char myBitmap [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0c, 0x1f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0x0f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x3f, 0x27, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe2, 0x7e, 0x4f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe4, 0x7c, 0xcf, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc4, 0xe1, 0x8f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0x03, 0x1f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf2, 0x3f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0xfc, 0x3f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x3f, 0xc0, 0x7f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xf8, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0xff, 0xc0, 0x02, 0x3f, 0xff, 0xc7, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x1f, 0xfc, 0x3f, 0xff, 0xfd, 0x0f, 0xe0, 0x3f, 0xf9, 0x8f, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x1f, 0xfe, 0x1f, 0xff, 0xfc, 0x3f, 0xf8, 0x3f, 0xf9, 0x8f, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x1f, 0xff, 0x0f, 0xff, 0xf8, 0x7f, 0xf8, 0x7f, 0xfb, 0x1f, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x8f, 0xff, 0x07, 0xff, 0xf1, 0xff, 0xf8, 0x7f, 0xff, 0x00, 0x1f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xc3, 0xfe, 0x83, 0xff, 0xe3, 0xff, 0xf0, 0xff, 0xfe, 0x07, 0x03, 0xff, 0xff, 0xff,
0xff, 0xff, 0xe0, 0xff, 0xe1, 0xff, 0xc7, 0xff, 0xf0, 0xff, 0xfc, 0x3f, 0xf1, 0xff, 0xff, 0xff,
0xff, 0xff, 0xf0, 0xff, 0x80, 0xff, 0xc7, 0xff, 0xe1, 0xff, 0xfc, 0x7f, 0xd9, 0xff, 0xff, 0xff,
0xff, 0xff, 0xf0, 0x7f, 0x00, 0x3f, 0x8f, 0xff, 0xc1, 0xff, 0xf8, 0x7f, 0xf8, 0xff, 0xff, 0xff,
0xff, 0xff, 0xf8, 0x3f, 0x00, 0x00, 0x1f, 0xff, 0xc3, 0xff, 0xf8, 0xff, 0xf0, 0x1f, 0xff, 0xff,
0xff, 0xff, 0xf8, 0x00, 0x01, 0x00, 0x1f, 0xff, 0x87, 0xff, 0xf0, 0xff, 0xf1, 0x8f, 0xff, 0xff,
0xff, 0xff, 0xfc, 0x00, 0x01, 0x84, 0x3f, 0xff, 0x87, 0xff, 0xf1, 0xff, 0xf1, 0xc7, 0xff, 0xff,
0xff, 0xff, 0xfe, 0x00, 0x01, 0x80, 0x7f, 0xff, 0x0f, 0xff, 0xe1, 0xff, 0xe3, 0xe7, 0xff, 0xff,
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0x1f, 0xff, 0xe3, 0xff, 0xc3, 0xe3, 0xff, 0xff,
0xff, 0xff, 0xff, 0x80, 0xff, 0x00, 0xff, 0xfe, 0x1f, 0xff, 0xc3, 0xff, 0x87, 0xe3, 0xff, 0xff,
0xff, 0xff, 0xff, 0xc3, 0xff, 0xc0, 0xff, 0xfe, 0x3f, 0xff, 0xc7, 0xff, 0xc7, 0xf1, 0xff, 0xff,
0xff, 0xff, 0xff, 0xe1, 0xff, 0xc1, 0xff, 0xfe, 0x7f, 0xff, 0x87, 0xff, 0x8f, 0xf1, 0xff, 0xff,
0xff, 0xff, 0xff, 0xf1, 0xff, 0x81, 0xff, 0xfc, 0xff, 0xff, 0x8f, 0xff, 0x8f, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xf8, 0x7e, 0x03, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0x0f, 0xfc, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfc, 0x18, 0x03, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xff, 0x1f, 0xfc, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x3f, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x7f, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xfe, 0x0f, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xf8, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xfd, 0xff, 0xf8, 0x00, 0xf0, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x80, 0x00, 0x7f, 0xf9, 0xff, 0xc0, 0x01, 0xe0, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0x80, 0x00, 0x0f, 0x80, 0x3f, 0x00, 0x7f, 0xc1, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xe1, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xc3, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0x07, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc0, 0x1f, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x1f, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3f, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x05, 0xff, 0xe0, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x10, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// '106870349-vecteur-d-icône-de-porte-isolé-sur-fond-blanc-pour-la-conception-de-votre-application-web-et-mobile-', 128x64px
const unsigned char myBitmap1 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x30, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x30, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
// 'istockphoto-1140967663-612x612', 128x64px
const unsigned char myBitmap2 [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x60, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x80, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
void setup()
{
Serial.begin(9600);
// Initialise le Timer 2 pour déclencher les interruptions à intervalle régulier
TCCR2A = 0; //default
TCCR2B = 0b00000110; // clk/256 est incrémenté toutes les 16uS
TIMSK2 = 0b00000001; // TOIE2
sei(); // autorise les interruptions
ecranOLED.begin(SSD1306_SWITCHCAPVCC, adresseI2CecranOLED);
ecranOLED.clearDisplay();
ecranOLED.setTextSize(2);
ecranOLED.setCursor(0, 0);
ecranOLED.setTextColor(SSD1306_WHITE);
ecranOLED.println("__________");
ecranOLED.println("GroupeInti");
ecranOLED.println("**ENJOY**");
ecranOLED.println("__________");
ecranOLED.display();
ecranOLED.setTextSize(1);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(3, INPUT); // INTERRUPTEUR intPORTE
pinMode(9, INPUT); // INTERRUPTEUR intCONTACTCLEF
pinMode(8, INPUT); // INTERRUPTEUR intAUTO
pinMode(6, INPUT); // pin marche avant
pinMode(12, INPUT); // pin marche arrière
pinMode(7, INPUT); // pin FIN COURSE
}
void ecran (String valeur1, String ouvert_ferme, String valeur2, int etat2 , String valeur3, int etat3 , String valeur4, int etat4 )
{
ecranOLED.clearDisplay();
ecranOLED.setTextSize(1);
ecranOLED.setCursor(0, 0);
ecranOLED.setTextColor(SSD1306_WHITE);
ecranOLED.println("__________");
ecranOLED.print(valeur1);
ecranOLED.print(" = ");
ecranOLED.println(ouvert_ferme);
ecranOLED.println("__________");
ecranOLED.print(valeur2);
ecranOLED.print(" = ");
ecranOLED.println(etat2);
ecranOLED.println("__________");
ecranOLED.print(valeur3);
ecranOLED.print(" = ");
ecranOLED.println(etat3);
ecranOLED.println("__________");
ecranOLED.print(valeur4);
ecranOLED.print(" = ");
ecranOLED.println(etat4);
ecranOLED.println("__________");
ecranOLED.display();
}
void mesure (String valeur, float tension )
{
ecranOLED.clearDisplay();
ecranOLED.setTextSize(1);
ecranOLED.setCursor(0, 0);
ecranOLED.setTextColor(SSD1306_WHITE);
ecranOLED.println("__________");
ecranOLED.print(valeur);
ecranOLED.print(" = ");
ecranOLED.print(tension);
ecranOLED.println(" V ");
ecranOLED.display();
}
void warning (String warm )
{
ecranOLED.clearDisplay();
ecranOLED.setTextSize(2);
ecranOLED.setCursor(0, 0);
ecranOLED.setTextColor(SSD1306_WHITE);
ecranOLED.println("__________");
ecranOLED.println(warm);
ecranOLED.println("__________");
ecranOLED.display();
}
void image (const unsigned char img )
{
ecranOLED.clearDisplay();
ecranOLED.setCursor(0, 0);
ecranOLED.drawBitmap(1, 1, myBitmap, 128, 64, 1);
ecranOLED.display();
}
void image1 (const unsigned char img1 )
{
ecranOLED.clearDisplay();
ecranOLED.setCursor(0, 0);
ecranOLED.drawBitmap(1, 1, myBitmap1, 128, 64, 1);
ecranOLED.display();
}
void image2 (const unsigned char img2 )
{
ecranOLED.clearDisplay();
ecranOLED.setCursor(0, 0);
ecranOLED.drawBitmap(1, 1, myBitmap2, 128, 64, 1);
ecranOLED.display();
}
int marcheavant1 ()
{
analogWrite(IN1, PWM1);
digitalWrite(IN2, LOW);
}
int marcheavant2 ()
{
analogWrite(IN1, PWM4);
digitalWrite(IN2, LOW);
}
int marchearriere1 ()
{
digitalWrite(IN1, LOW);
analogWrite(IN2, PWM1 );
}
int marchearriere2 ()
{
digitalWrite(IN1, LOW);
analogWrite(IN2, PWM2 );
}
int Stop ()
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW );
}
void loop()
{
if (intAUTO == 1)
{
// warning("Mode Auto");
if (intPORTE == 1 && bpFINCOURSE == 0 && intCONTACTCLEF == 0 )
{
if (flag1 == 0 || flag1 == 2 || flag1 == 1 || flag1 == 3)
{
//image1(myBitmap1);
//warning(" Porte Ouverte");
if (marche_arriere_active == 0 || marche_avant_obstacle_active == 0)
{
chrono_marche_avant = millis();
marche_avant_active = 1;
}
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
}
flag1 = 1;
}
if (intPORTE == 0 && bpFINCOURSE == 1)
{
if (flag1 == 1)
{
// image2(myBitmap2);
//warning(" Porte Fermer");
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
flag1 = 0;
}
}
if (bpFINCOURSE == 1 && intCONTACTCLEF == 1 && intPORTE == 1)
{
if (flag1 == 0 || flag1 == 1 || flag1 == 3 )
{
//image1(myBitmap1);
//warning(" Porte Ouverte");
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
flag1 = 2;
}
}
if (bpFINCOURSE == 1 && intCONTACTCLEF == 1 && intPORTE == 0)
{
if (flag1 == 0 || flag1 == 2 || flag1 == 1)
{
//image2(myBitmap2);
//warning(" Porte Fermer");
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
flag1 = 3;
}
}
if (intCONTACTCLEF == 1 && intPORTE == 1 && bpFINCOURSE == 0)
{
//image1(myBitmap1);
//warning(" Porte Ouverte");
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
Stop();
}
}
if (intAUTO == 0)
{
//warning(" Mode Manuel");
if (bpMAV == 0 && bpMAR == 0 && intPORTE == 0 && intCONTACTCLEF == 0 )
{
// image2(myBitmap2);
// warning(" Porte Fermer");
//ecran ("CAP PORTE", "FERMER", "CAPTEUR CLEF", 0, "BP AV", 0, "BP AR", 0);
}
if (bpMAV == 1 && bpMAR == 0 && intPORTE == 0 && intCONTACTCLEF == 0 )
{
//image2(myBitmap2);
//warning(" Porte Fermer");
//ecran ("CAP PORTE", "FERMER", "CAPTEUR CLEF", 0, "BP AV", 1, "BP AR", 0);
if (marche_arriere_active == 0 || marche_avant_obstacle_active == 0)
{
chrono_marche_avant = millis();
marche_avant_active = 1;
}
}
if (bpMAV == 0 && bpMAR == 1 && intPORTE == 0 && intCONTACTCLEF == 0 )
{
//image2(myBitmap2);
//warning(" Porte Fermer");
//ecran ("CAP PORTE", "FERMER", "CAPTEUR CLEF", 0, "BP AV", 0, "BP AR", 1);
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
}
if (bpMAV == 0 && bpMAR == 0 && intPORTE == 0 && intCONTACTCLEF == 1 )
{
// image2(myBitmap2);
// warning(" Porte Fermer");
//ecran ("CAP PORTE", "FERMER", "CAPTEUR CLEF", 1, "BP AV", 0, "BP AR", 0);
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
}
if (bpMAV == 0 && bpMAR == 0 && intPORTE == 1 && intCONTACTCLEF == 1 )
{
// image1(myBitmap1);
// warning(" Porte Ouverte");
//ecran ("CAP PORTE", "OUVERTE", "CAPTEUR CLEF", 1, "BP AV", 0, "BP AR", 0);
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
}
if (bpMAV == 1 && bpMAR == 1 && intPORTE == 1 && intCONTACTCLEF == 1 )
{
//ecran ("NO", "1", "NO", 1, "NO", 1, "NO", 1);
//image(myBitmap1);
}
if (bpMAV == 1 && bpMAR == 0 && intPORTE == 1 && intCONTACTCLEF == 0 )
{
//image1(myBitmap1);
// warning(" Porte Ouverte");
//ecran ("CAP PORTE", "OUVERTE", "CAPTEUR CLEF", 0, "BP AV", 1, "BP AR", 0);
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
if (marche_arriere_active == 0 || marche_avant_obstacle_active == 0)
{
chrono_marche_avant = millis();
marche_avant_active = 1;
}
}
if (bpMAV == 0 && bpMAR == 1 && intPORTE == 1 && intCONTACTCLEF == 0 )
{
//image1(myBitmap1);
//warning(" Porte Ouverte");
//ecran ("CAP PORTE", "OUVERTE", "CAPTEUR CLEF", 0, "BP AV", 0, "BP AR", 1);
if (marche_avant_active == 0 || marche_arriere_obstacle_active == 0)
{
chrono_marche_arriere = millis();
marche_arriere_active = 1;
}
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
}
if (bpMAV == 0 && bpMAR == 0 && intPORTE == 1 && intCONTACTCLEF == 0 )
{
// ecran ("CAP PORTE", "OUVERTE", "CAPTEUR CLEF", 0, "BP AV", 0, "BP AR", 0);
// image1(myBitmap1);
//warning(" Porte Ouverte");
chrono_porte_ouverte = millis();
porte_ouverte_active = 1;
}
}
float SensorRead = analogRead(A2) * 5.0 / 1023.0; //We read the sensor output
mesure("tension", SensorRead);
if (marche_avant_active == 1 )
{
delai_marche_avant = millis() - chrono_marche_avant;
Serial.print (" delai_marche_avant=");
Serial.println (delai_marche_avant);
}
if (marche_avant_active == 1 && delai_marche_avant < 850 )
{
Serial.print ("delai_marche_avant: marcheavant1");
marcheavant1();
}
if ( marche_avant_active == 1 && delai_marche_avant <= 2500 && delai_marche_avant >= 850)
{
Serial.print ("delai_marche_avant: marcheavant2");
marcheavant2();
}
if ( marche_avant_active == 1 && delai_marche_avant > 2500 )
{
Serial.print ("delai_marche_avant: Stop");
Stop();
marche_avant_active = 0;
}
if (marche_avant_active == 1 && delai_marche_avant < 2500 && SensorRead < 2.20)
{
Serial.println ("delai_marche_avant: obstacle");
chrono_marche_avant_obstacle = millis();
marche_avant_active = 0;
marche_avant_obstacle_active = 1;
}
if (marche_avant_obstacle_active == 1 )
{
delai_marche_avant_obstacle = millis() - chrono_marche_avant_obstacle;
Serial.print (" delai_marche_avant_obstacle=");
Serial.println (delai_marche_avant_obstacle);
marchearriere1();
}
if ( marche_avant_obstacle_active == 1 && delai_marche_avant_obstacle >= delai_marche_avant )
{
Serial.print (" delai_marche_avant: Stop");
Stop();
marche_avant_obstacle_active = 0;
}
if (marche_arriere_active == 1 )
{
delai_marche_arriere = millis() - chrono_marche_arriere;
Serial.print (" delai_marche_arriere=");
Serial.println (delai_marche_arriere);
}
if (marche_arriere_active == 1 && delai_marche_arriere < 1100 )
{
Serial.print ("marchearriere1");
marchearriere1();
}
if ( marche_arriere_active == 1 && delai_marche_arriere < 2700 && delai_marche_arriere >= 1100)
{
Serial.print ("marchearriere2");
marchearriere2();
}
if ( marche_arriere_active == 1 && delai_marche_arriere > 2700)
{
Serial.print ("Stop");
Stop();
marche_arriere_active = 0;
}
if (marche_arriere_active == 1 && delai_marche_arriere < 2700 && SensorRead > 2.95)
{
chrono_marche_arriere_obstacle = millis();
marche_arriere_active = 0;
marche_arriere_obstacle_active = 1;
}
if (marche_arriere_obstacle_active == 1 )
{
delai_marche_arriere_obstacle = millis() - chrono_marche_arriere_obstacle;
Serial.println ("delai_obstacle=");
Serial.println (delai_marche_arriere_obstacle);
marchearriere1();
}
if ( marche_arriere_obstacle_active == 1 && delai_marche_arriere_obstacle >= delai_marche_arriere )
{
//Serial.print (" delai_marche_arriere: Stop");
Stop();
marche_arriere_obstacle_active = 0;
}
}
// routine d'interruption du timer
ISR (TIMER2_OVF_vect)
{
// 256-6 --> 250X16uS = 4mS
// Recharge le timer pour que la prochaine interruption se déclenche dans 4mS
TCNT2 = 6;
//================================//
//je vais lire toutes les entrées//
//================================//
bpMAV = digitalRead (6);// le bp av
bpMAR = digitalRead (12);// le bp arr
intPORTE = digitalRead (3);// le bp intPORTE
intCONTACTCLEF = digitalRead (9);// le bp intCONTACTCLEF
intAUTO = digitalRead (8);// le bp intAUTO
bpFINCOURSE = digitalRead (7);// le bpFINCOURSE
//================================//
//================================//
//================================//
}