Compare commits
No commits in common. "baa82893ad9007c36171f641a23e97e1f2934ad0" and "5a214c30779f7495a1a70e9aab3cb8a3dde516ea" have entirely different histories.
baa82893ad
...
5a214c3077
32 changed files with 40 additions and 480 deletions
|
|
@ -1,32 +0,0 @@
|
||||||
/*********************************************************************
|
|
||||||
* @file Apllication.cpp
|
|
||||||
* @author <mettre l'adresse mail ou nom prenom>
|
|
||||||
* @brief Fichier source de l'application
|
|
||||||
*********************************************************************/
|
|
||||||
#include "Application.h"
|
|
||||||
|
|
||||||
|
|
||||||
Application::Application()
|
|
||||||
{
|
|
||||||
// Code
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::~Application()
|
|
||||||
{
|
|
||||||
// Code
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::init(void)
|
|
||||||
{
|
|
||||||
// Code
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Application::run(void)
|
|
||||||
{
|
|
||||||
// Code
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
/*********************************************************************
|
|
||||||
* @file Apllication.h
|
|
||||||
* @author <mettre l'adresse mail ou nom prenom>
|
|
||||||
* @brief Fichier header de l'application
|
|
||||||
*********************************************************************/
|
|
||||||
#ifndef APPLICATION_H_
|
|
||||||
#define APPLICATION_H_
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class Application
|
|
||||||
* @brief Classe Application
|
|
||||||
*/
|
|
||||||
class Application
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
/**
|
|
||||||
* @fn Application();
|
|
||||||
* @brief Constructeur par defaut
|
|
||||||
*/
|
|
||||||
Application();
|
|
||||||
/**
|
|
||||||
* @fn Application();
|
|
||||||
* @brief Destructeur
|
|
||||||
*/
|
|
||||||
~Application();
|
|
||||||
/**
|
|
||||||
* @fn void init(void)
|
|
||||||
* @brief Fonction d'initialisation de l'application
|
|
||||||
*/
|
|
||||||
void init(void);
|
|
||||||
/**
|
|
||||||
* @fn void run(void)
|
|
||||||
* @brief Fonction de lancement de l'application
|
|
||||||
*/
|
|
||||||
void run(void);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
#include "Application.h"
|
|
||||||
|
|
||||||
Application myApplication;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// put your setup code here, to run once:
|
|
||||||
myApplication.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// put your main code here, to run repeatedly:
|
|
||||||
myApplication.run();
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
#include "actionneur.h"
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef actionneur_H
|
|
||||||
#define actionneur_H
|
|
||||||
#include "peripherique.h"
|
|
||||||
class actionneur : public periph {
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
|
||||||
actionneur():periph(){};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#include "bouton.h"
|
|
||||||
|
|
||||||
bouton:: bouton() :capteur(),etat(0){}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#ifndef bouton_H
|
|
||||||
#define bouton_H
|
|
||||||
#include "capteur.h"
|
|
||||||
class bouton : public capteur {
|
|
||||||
private:
|
|
||||||
bool etat;
|
|
||||||
public:
|
|
||||||
bouton();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
#include "capteur.h"
|
|
||||||
|
|
||||||
capteur:: capteur() :periph(),pin(0){}
|
|
||||||
|
|
||||||
void init(){
|
|
||||||
pinMode(pin, INPUT);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#ifndef capteur_H
|
|
||||||
#define capteur_H
|
|
||||||
#include "peripherique.h"
|
|
||||||
class capteur : public periph {
|
|
||||||
private:
|
|
||||||
char* pin;
|
|
||||||
public:
|
|
||||||
capteur();
|
|
||||||
void set(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#ifndef ecran_H
|
|
||||||
#define ecran_H
|
|
||||||
#include "actionneur.h"
|
|
||||||
#include "rgb_lcd.h"
|
|
||||||
class ecran : public actionneur, public rgb_lcd {
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
|
||||||
ecran():actionneur(),rgb_lcd(){};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
led:: led() :actionneur(),pin(0),etat(0){}
|
|
||||||
|
|
||||||
void init(){
|
|
||||||
pinMode(pin, OUTPUT);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
#ifndef led_H
|
|
||||||
#define led_H
|
|
||||||
#include "actionneur.h"
|
|
||||||
|
|
||||||
class led : public actionneur{
|
|
||||||
private:
|
|
||||||
char* pin;
|
|
||||||
bool etat;
|
|
||||||
public:
|
|
||||||
led();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#include "peripherique.h"
|
|
||||||
|
|
||||||
periph::periph() : id(0) {}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef periph_H
|
|
||||||
#define periph_H
|
|
||||||
|
|
||||||
class periph {
|
|
||||||
private:
|
|
||||||
char id;
|
|
||||||
public:
|
|
||||||
periph();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
/*********************************************************************
|
|
||||||
* @file Apllication.cpp
|
|
||||||
* @author <mettre l'adresse mail ou nom prenom>
|
|
||||||
* @brief Fichier source de l'application
|
|
||||||
*********************************************************************/
|
|
||||||
#include "Application.h"
|
|
||||||
#include <Wire.h>
|
|
||||||
#include "rgb_lcd.h"
|
|
||||||
#include "ecran.h"
|
|
||||||
#include "bdd.h"
|
|
||||||
#include "bouton.h"
|
|
||||||
const int buttonPin = D8; // the number of the pushbutton pin
|
|
||||||
const int ledPin = D7; // the number of the LED pin
|
|
||||||
int buttonState = 0;
|
|
||||||
ecran lcd;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const int colorR = 255;
|
|
||||||
const int colorG = 100;
|
|
||||||
const int colorB = 100;
|
|
||||||
Application::Application()
|
|
||||||
{
|
|
||||||
// Code
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::~Application()
|
|
||||||
{
|
|
||||||
// Code
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::init(void)
|
|
||||||
{
|
|
||||||
pinMode(ledPin, OUTPUT);
|
|
||||||
pinMode(buttonPin, INPUT);
|
|
||||||
bouton Bouton1(buttonPin);
|
|
||||||
|
|
||||||
// set up the LCD's number of columns and rows:
|
|
||||||
lcd.begin(32, 16);
|
|
||||||
|
|
||||||
lcd.setRGB(colorR, colorG, colorB);
|
|
||||||
|
|
||||||
// Print a message to the LCD.
|
|
||||||
lcd.print("On commence a jouer?");
|
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
listequestions_init(lcd);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Application::run(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
// set the cursor to column 0, line 1
|
|
||||||
// (note: line 1 is the second row, since counting begins with 0):
|
|
||||||
//lcd.setCursor(0, 1);
|
|
||||||
// print the number of seconds since reset:
|
|
||||||
//lcd.print(millis() / 1000);
|
|
||||||
|
|
||||||
delay(100);
|
|
||||||
}
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
/*********************************************************************
|
|
||||||
* @file Apllication.h
|
|
||||||
* @author <mettre l'adresse mail ou nom prenom>
|
|
||||||
* @brief Fichier header de l'application
|
|
||||||
*********************************************************************/
|
|
||||||
#ifndef APPLICATION_H_
|
|
||||||
#define APPLICATION_H_
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @class Application
|
|
||||||
* @brief Classe Application
|
|
||||||
*/
|
|
||||||
class Application
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
/**
|
|
||||||
* @fn Application();
|
|
||||||
* @brief Constructeur par defaut
|
|
||||||
*/
|
|
||||||
Application();
|
|
||||||
/**
|
|
||||||
* @fn Application();
|
|
||||||
* @brief Destructeur
|
|
||||||
*/
|
|
||||||
~Application();
|
|
||||||
/**
|
|
||||||
* @fn void init(void)
|
|
||||||
* @brief Fonction d'initialisation de l'application
|
|
||||||
*/
|
|
||||||
void init(void);
|
|
||||||
/**
|
|
||||||
* @fn void run(void)
|
|
||||||
* @brief Fonction de lancement de l'application
|
|
||||||
*/
|
|
||||||
void run(void);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
#include "actionneur.h"
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef actionneur_H
|
|
||||||
#define actionneur_H
|
|
||||||
#include "peripherique.h"
|
|
||||||
class actionneur : public periph {
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
|
||||||
actionneur():periph(){};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
#include "bdd.h"
|
|
||||||
#include "ecran.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <list>
|
|
||||||
#include <algorithm>
|
|
||||||
#include "string.h"
|
|
||||||
using namespace std;
|
|
||||||
void listequestions_init(ecran& lcd){
|
|
||||||
list<string> listeQ;
|
|
||||||
list<string>::iterator it;
|
|
||||||
listeQ.push_back("1 Disney");
|
|
||||||
listeQ.push_back("2 Geographie");
|
|
||||||
lcd.clear();
|
|
||||||
lcd.print("Thematiques : ");
|
|
||||||
delay(3000);
|
|
||||||
lcd.clear();
|
|
||||||
int nbT=0;
|
|
||||||
for(it=listeQ.begin();it!=listeQ.end();it++) {
|
|
||||||
|
|
||||||
lcd.setCursor(0, nbT++);
|
|
||||||
lcd.print((*it).c_str());
|
|
||||||
|
|
||||||
|
|
||||||
}//cout<<*it<<" ";
|
|
||||||
delay(5000);
|
|
||||||
|
|
||||||
list<string> Questions_Disney;
|
|
||||||
Questions_Disney.push_back("Patrick est le nom du cameleon de Raiponce ?");
|
|
||||||
Questions_Disney.push_back("La robe de Tiana est verte ?");
|
|
||||||
Questions_Disney.push_back("Cendrillon etait le premier disney ?");
|
|
||||||
|
|
||||||
for(it=Questions_Disney.begin();it!=Questions_Disney.end();it++) {
|
|
||||||
lcd.clear();
|
|
||||||
lcd.setCursor(0, 0);
|
|
||||||
lcd.print((*it).c_str());
|
|
||||||
|
|
||||||
// Fait défiler le texte vers la gauche
|
|
||||||
for(int i = 0; i < (*it).length(); i++) {
|
|
||||||
lcd.scrollDisplayLeft();
|
|
||||||
delay(300);
|
|
||||||
}
|
|
||||||
delay(2000);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*cout<<endl;
|
|
||||||
cout<<"Questions_Disney : "<<endl;
|
|
||||||
for(it=Questions_Disney.begin();it!=Questions_Disney.end();it++) {cout<<*it<<" ";cout<<endl;}
|
|
||||||
cout<<endl;*/
|
|
||||||
|
|
||||||
list<string> Questions_Geographie;
|
|
||||||
Questions_Geographie.push_back("Rio de Janeiro est la capitale du Bresil ?");
|
|
||||||
Questions_Geographie.push_back("L'Inde est le pays le plus peuple ?");
|
|
||||||
Questions_Geographie.push_back("Les Pyrenees Atlantiques ont 64 en numéro de département ?");
|
|
||||||
/*cout<<"Questions_Géographie : "<<endl;
|
|
||||||
|
|
||||||
for(it=Questions_Disney.begin();it!=Questions_Disney.end();it++) {cout<<*it<<" ";cout<<endl;}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#ifndef bdd_H
|
|
||||||
#define bdd_H
|
|
||||||
#include "ecran.h"
|
|
||||||
void listequestions_init(ecran& lcd);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#include "bouton.h"
|
|
||||||
|
|
||||||
bouton:: bouton() :capteur(),etat(0){}
|
|
||||||
bouton::bouton(int pin) : capteur(pin), etat(0) {}
|
|
||||||
|
|
||||||
bool bouton::lire_etat(bouton& B){
|
|
||||||
bool res;
|
|
||||||
int buttonState = digitalRead(B.getpin());
|
|
||||||
if (buttonState == HIGH) res=1;
|
|
||||||
else res=0;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef bouton_H
|
|
||||||
#define bouton_H
|
|
||||||
#include "capteur.h"
|
|
||||||
class bouton : public capteur {
|
|
||||||
private:
|
|
||||||
bool etat;
|
|
||||||
public:
|
|
||||||
bouton();
|
|
||||||
bouton(int pin);
|
|
||||||
bool lire_etat(bouton& B);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
#include "capteur.h"
|
|
||||||
|
|
||||||
capteur:: capteur() :periph(),pin(0){}
|
|
||||||
|
|
||||||
|
|
||||||
capteur::capteur(int p) : periph(), pin(p) {
|
|
||||||
pinMode(pin, INPUT); // Configure directement le pin
|
|
||||||
}
|
|
||||||
|
|
||||||
void capteur::init(){
|
|
||||||
pinMode(pin, INPUT);
|
|
||||||
|
|
||||||
}
|
|
||||||
int capteur::getpin(){
|
|
||||||
return pin;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef capteur_H
|
|
||||||
#define capteur_H
|
|
||||||
#include "peripherique.h"
|
|
||||||
class capteur : public periph {
|
|
||||||
private:
|
|
||||||
int pin;
|
|
||||||
public:
|
|
||||||
capteur();
|
|
||||||
capteur(int p);
|
|
||||||
void init(void);
|
|
||||||
int getpin();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#ifndef ecran_H
|
|
||||||
#define ecran_H
|
|
||||||
#include "actionneur.h"
|
|
||||||
#include "rgb_lcd.h"
|
|
||||||
class ecran : public actionneur, public rgb_lcd {
|
|
||||||
private:
|
|
||||||
|
|
||||||
public:
|
|
||||||
ecran():actionneur(),rgb_lcd(){};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#include "led.h"
|
|
||||||
|
|
||||||
|
|
||||||
led:: led() :actionneur(),pin(0),etat(0){}
|
|
||||||
|
|
||||||
void led::init(){
|
|
||||||
pinMode(pin, OUTPUT);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#ifndef led_H
|
|
||||||
#define led_H
|
|
||||||
#include "actionneur.h"
|
|
||||||
|
|
||||||
class led : public actionneur{
|
|
||||||
private:
|
|
||||||
int pin;
|
|
||||||
bool etat;
|
|
||||||
public:
|
|
||||||
led();
|
|
||||||
void init(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#include "peripherique.h"
|
|
||||||
|
|
||||||
periph::periph() : id(0) {}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
#ifndef periph_H
|
|
||||||
#define periph_H
|
|
||||||
#include "Arduino.h"
|
|
||||||
class periph {
|
|
||||||
private:
|
|
||||||
char id;
|
|
||||||
public:
|
|
||||||
periph();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
#include "Application.h"
|
|
||||||
|
|
||||||
Application myApplication;
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
// put your setup code here, to run once:
|
|
||||||
myApplication.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{
|
|
||||||
// put your main code here, to run repeatedly:
|
|
||||||
myApplication.run();
|
|
||||||
}
|
|
||||||
1
README.md
Normal file
1
README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ma forumle magique
|
||||||
39
td5.cpp
Normal file
39
td5.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include <iostream>
|
||||||
|
#include "string.h"
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class capteur{
|
||||||
|
protected:
|
||||||
|
char id;
|
||||||
|
bool actif;
|
||||||
|
int pin;
|
||||||
|
|
||||||
|
public:
|
||||||
|
capteur() : id('0'), actif(true), pin(0) {}
|
||||||
|
capteur(int pin) : id('0'), actif(true), pin(pin) {}
|
||||||
|
capteur(char id,int pin): id(id), actif(true), pin(pin) {}
|
||||||
|
~capteur(){}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class bouton: public capteur{
|
||||||
|
protected:
|
||||||
|
bool etatbouton;
|
||||||
|
public:
|
||||||
|
bouton():capteur(){}
|
||||||
|
bouton(bool etat) : capteur(), etatbouton(etat) {}
|
||||||
|
bouton(int pin, bool etat) : capteur(pin), etatbouton(etat) {}
|
||||||
|
bouton(char id, int pin, bool etat) : capteur(id, pin), etatbouton(etat) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
bouton boutonA('A',1,true);
|
||||||
|
bouton boutonB('B',2,true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue