Compare commits

..

2 commits

Author SHA1 Message Date
Montaigu-Lancelin Emilie
baa82893ad tp1812fin 2025-12-18 12:06:34 +01:00
Montaigu-Lancelin Emilie
62b5e6323a debuttp1812 2025-12-18 10:13:20 +01:00
32 changed files with 480 additions and 40 deletions

View file

@ -0,0 +1,32 @@
/*********************************************************************
* @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
;
}

View file

@ -0,0 +1,37 @@
/*********************************************************************
* @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

View file

@ -0,0 +1,15 @@
#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();
}

View file

@ -0,0 +1,2 @@
#include "actionneur.h"

View file

@ -0,0 +1,11 @@
#ifndef actionneur_H
#define actionneur_H
#include "peripherique.h"
class actionneur : public periph {
private:
public:
actionneur():periph(){};
};
#endif

View file

@ -0,0 +1,3 @@
#include "bouton.h"
bouton:: bouton() :capteur(),etat(0){}

12
BE c/HelloWorld/bouton.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef bouton_H
#define bouton_H
#include "capteur.h"
class bouton : public capteur {
private:
bool etat;
public:
bouton();
};
#endif

View file

@ -0,0 +1,8 @@
#include "capteur.h"
capteur:: capteur() :periph(),pin(0){}
void init(){
pinMode(pin, INPUT);
}

12
BE c/HelloWorld/capteur.h Normal file
View file

@ -0,0 +1,12 @@
#ifndef capteur_H
#define capteur_H
#include "peripherique.h"
class capteur : public periph {
private:
char* pin;
public:
capteur();
void set(void);
};
#endif

12
BE c/HelloWorld/ecran.h Normal file
View file

@ -0,0 +1,12 @@
#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

9
BE c/HelloWorld/led.cpp Normal file
View file

@ -0,0 +1,9 @@
#include "led.h"
led:: led() :actionneur(),pin(0),etat(0){}
void init(){
pinMode(pin, OUTPUT);
}

13
BE c/HelloWorld/led.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef led_H
#define led_H
#include "actionneur.h"
class led : public actionneur{
private:
char* pin;
bool etat;
public:
led();
};
#endif

View file

@ -0,0 +1,3 @@
#include "peripherique.h"
periph::periph() : id(0) {}

View file

@ -0,0 +1,11 @@
#ifndef periph_H
#define periph_H
class periph {
private:
char id;
public:
periph();
};
#endif

View file

@ -0,0 +1,64 @@
/*********************************************************************
* @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);
}

37
BE c/projet/Application.h Normal file
View file

@ -0,0 +1,37 @@
/*********************************************************************
* @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

View file

@ -0,0 +1,2 @@
#include "actionneur.h"

11
BE c/projet/actionneur.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef actionneur_H
#define actionneur_H
#include "peripherique.h"
class actionneur : public periph {
private:
public:
actionneur():periph(){};
};
#endif

60
BE c/projet/bdd.cpp Normal file
View file

@ -0,0 +1,60 @@
#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;}
*/
}

6
BE c/projet/bdd.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef bdd_H
#define bdd_H
#include "ecran.h"
void listequestions_init(ecran& lcd);
#endif

12
BE c/projet/bouton.cpp Normal file
View file

@ -0,0 +1,12 @@
#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;
}

14
BE c/projet/bouton.h Normal file
View file

@ -0,0 +1,14 @@
#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

16
BE c/projet/capteur.cpp Normal file
View file

@ -0,0 +1,16 @@
#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;
}

14
BE c/projet/capteur.h Normal file
View file

@ -0,0 +1,14 @@
#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

12
BE c/projet/ecran.h Normal file
View file

@ -0,0 +1,12 @@
#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

9
BE c/projet/led.cpp Normal file
View file

@ -0,0 +1,9 @@
#include "led.h"
led:: led() :actionneur(),pin(0),etat(0){}
void led::init(){
pinMode(pin, OUTPUT);
}

14
BE c/projet/led.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef led_H
#define led_H
#include "actionneur.h"
class led : public actionneur{
private:
int pin;
bool etat;
public:
led();
void init(void);
};
#endif

View file

@ -0,0 +1,3 @@
#include "peripherique.h"
periph::periph() : id(0) {}

View file

@ -0,0 +1,11 @@
#ifndef periph_H
#define periph_H
#include "Arduino.h"
class periph {
private:
char id;
public:
periph();
};
#endif

15
BE c/projet/projet.ino Normal file
View file

@ -0,0 +1,15 @@
#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();
}

View file

@ -1 +0,0 @@
ma forumle magique

39
td5.cpp
View file

@ -1,39 +0,0 @@
#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;
}