changement de version board manager
This commit is contained in:
parent
dfa84baeb2
commit
33cf7a172c
@ -14,6 +14,8 @@ Adafruit_MPR121 cap = Adafruit_MPR121();
|
||||
uint16_t lasttouched = 0;
|
||||
uint16_t currtouched = 0;
|
||||
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
randomSeed(analogRead(0));
|
||||
|
||||
251
localMode.cpp
251
localMode.cpp
@ -6,15 +6,15 @@
|
||||
extern Adafruit_SH1107 display;
|
||||
|
||||
MechKey keys[] = {
|
||||
{0, A0, false, Adafruit_NeoPixel(1, A0, NEO_GRB + NEO_KHZ800)},
|
||||
{1, 25, false, Adafruit_NeoPixel(1, 25, NEO_GRB + NEO_KHZ800)},
|
||||
{2, 34, false, Adafruit_NeoPixel(1, 34, NEO_GRB + NEO_KHZ800)},
|
||||
{3, 39, false, Adafruit_NeoPixel(1, 39, NEO_GRB + NEO_KHZ800)},
|
||||
{4, 36, false, Adafruit_NeoPixel(1, 36, NEO_GRB + NEO_KHZ800)},
|
||||
{5, 4, false, Adafruit_NeoPixel(1, 4, NEO_GRB + NEO_KHZ800)},
|
||||
{6, 14, false, Adafruit_NeoPixel(1, 14, NEO_GRB + NEO_KHZ800)},
|
||||
{7, 33, false, Adafruit_NeoPixel(1, 33, NEO_GRB + NEO_KHZ800)},
|
||||
{8, 15, false, Adafruit_NeoPixel(1, 15, NEO_GRB + NEO_KHZ800)},
|
||||
{0, A0, false, Adafruit_NeoPixel(1, D4, NEO_GRB + NEO_KHZ800)}, //D4
|
||||
{1, 25, false, Adafruit_NeoPixel(1, D5, NEO_GRB + NEO_KHZ800)},
|
||||
{2, 34, false, Adafruit_NeoPixel(1, A0, NEO_GRB + NEO_KHZ800)},
|
||||
{3, 39, false, Adafruit_NeoPixel(1, A1, NEO_GRB + NEO_KHZ800)},
|
||||
{4, 36, false, Adafruit_NeoPixel(1, 16, NEO_GRB + NEO_KHZ800)},
|
||||
{5, 4, false, Adafruit_NeoPixel(1, 17, NEO_GRB + NEO_KHZ800)},
|
||||
{6, 14, false, Adafruit_NeoPixel(1, D2, NEO_GRB + NEO_KHZ800)},
|
||||
{7, 33, false, Adafruit_NeoPixel(1, D3, NEO_GRB + NEO_KHZ800)}, //D3
|
||||
{8, 15, false, Adafruit_NeoPixel(1, 4, NEO_GRB + NEO_KHZ800)},
|
||||
};
|
||||
const int numKeys = 9;
|
||||
|
||||
@ -32,23 +32,40 @@ unsigned long lastDebounceReset = 0;
|
||||
const unsigned long debounceDelayReset = 200;
|
||||
uint8_t btnPrev = LOW;
|
||||
uint8_t btn;
|
||||
bool isFirstInit = true;
|
||||
|
||||
|
||||
bool isWin = false;
|
||||
|
||||
int c1[] = {-1,-1};
|
||||
int c2[] = {-1,-1};
|
||||
int c3[] = {-1,-1};
|
||||
|
||||
void setBtn(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtouched){
|
||||
if(isFirstInit){
|
||||
turnOff();
|
||||
isFirstInit = false;
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.print("Veuillez rester\nappuye sur chaqu'un\ndes boutons pendant\n3 secondes avant de\nles relacher pour\nles initialiser");
|
||||
display.print("Rester appuye sur\nchaqu'un des boutons\npendant 3 secondes\npour les initialiser");
|
||||
display.display();
|
||||
|
||||
if(allInit()){
|
||||
isBtnSet = true;
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
keys[i].led.setPixelColor(0, 0,0,0);
|
||||
keys[i].led.show();
|
||||
}
|
||||
}else{
|
||||
currtouched = cap.touched();
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
uint8_t t = keys[i].touchID;
|
||||
keys[i].led.setPixelColor(0, 255); // Bleu
|
||||
keys[i].led.show();
|
||||
if ((currtouched & _BV(t)) && !(lasttouched & _BV(t))) {
|
||||
Serial.print("Touch "); Serial.print(t); Serial.println(" pressed");
|
||||
btns[i] = true;
|
||||
keys[i].led.setPixelColor(0, 255,255,255);
|
||||
keys[i].led.show();
|
||||
}
|
||||
}
|
||||
lasttouched = currtouched;
|
||||
@ -73,16 +90,44 @@ Coord getCo(int key) {
|
||||
bool victoire(int grille[3][3], int joueur) {
|
||||
// Vérification des lignes et colonnes
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (grille[i][0] == joueur && grille[i][1] == joueur && grille[i][2] == joueur)
|
||||
return true;
|
||||
if (grille[0][i] == joueur && grille[1][i] == joueur && grille[2][i] == joueur)
|
||||
return true;
|
||||
if (grille[i][0] == joueur && grille[i][1] == joueur && grille[i][2] == joueur){
|
||||
c1[0]=i;
|
||||
c1[1]=0;
|
||||
c2[0]=i;
|
||||
c2[1]=1;
|
||||
c3[0]=i;
|
||||
c3[1]=2;
|
||||
return true;
|
||||
}
|
||||
if (grille[0][i] == joueur && grille[1][i] == joueur && grille[2][i] == joueur){
|
||||
c1[0]=0;
|
||||
c1[1]=i;
|
||||
c2[0]=1;
|
||||
c2[1]=i;
|
||||
c3[0]=2;
|
||||
c3[1]=i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Vérification des deux diagonales
|
||||
if (grille[0][0] == joueur && grille[1][1] == joueur && grille[2][2] == joueur)
|
||||
return true;
|
||||
if (grille[0][2] == joueur && grille[1][1] == joueur && grille[2][0] == joueur)
|
||||
return true;
|
||||
if (grille[0][0] == joueur && grille[1][1] == joueur && grille[2][2] == joueur){
|
||||
c1[0]=0;
|
||||
c1[1]=0;
|
||||
c2[0]=1;
|
||||
c2[1]=1;
|
||||
c3[0]=2;
|
||||
c3[1]=2;
|
||||
return true;
|
||||
}
|
||||
if (grille[0][2] == joueur && grille[1][1] == joueur && grille[2][0] == joueur){
|
||||
c1[0]=0;
|
||||
c1[1]=2;
|
||||
c2[0]=1;
|
||||
c2[1]=1;
|
||||
c3[0]=2;
|
||||
c3[1]=0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -93,16 +138,6 @@ bool allInit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void afficheGrille() {
|
||||
Serial.println("==============");
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 3; j++) {
|
||||
Serial.print(grille[i][j]);
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
|
||||
void reset() {
|
||||
Serial.println("Reset");
|
||||
|
||||
@ -111,9 +146,12 @@ void reset() {
|
||||
grille[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
isWin = false;
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
keys[i].led.setPixelColor(0, 0,0,0);
|
||||
keys[i].led.show();
|
||||
}
|
||||
joueur1 = true;
|
||||
afficheGrille();
|
||||
}
|
||||
|
||||
void readButtonReset() {
|
||||
@ -129,31 +167,40 @@ void readButtonReset() {
|
||||
void localModeDuo(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtouched) {
|
||||
currtouched = cap.touched();
|
||||
readButtonReset();
|
||||
|
||||
if(!isWin){
|
||||
menuGame();
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
uint8_t t = keys[i].touchID;
|
||||
|
||||
if ((currtouched & _BV(t)) && !(lasttouched & _BV(t))) {
|
||||
Serial.print("Touch "); Serial.print(t); Serial.println(" pressed");
|
||||
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
uint8_t t = keys[i].touchID;
|
||||
|
||||
if ((currtouched & _BV(t)) && !(lasttouched & _BV(t))) {
|
||||
Serial.print("Touch "); Serial.print(t); Serial.println(" pressed");
|
||||
|
||||
Coord c = getCo(i);
|
||||
if(grille[c.y][c.x] == 0) {
|
||||
if(joueur1) {
|
||||
grille[c.y][c.x] = 1;
|
||||
afficheGrille();
|
||||
if(victoire(grille, 1)) {
|
||||
Serial.println("Joueur 1 a gagne");
|
||||
}
|
||||
} else {
|
||||
grille[c.y][c.x] = 2;
|
||||
afficheGrille();
|
||||
if(victoire(grille, 2)) {
|
||||
Serial.println("Joueur 2 a gagne");
|
||||
Coord c = getCo(i);
|
||||
if(grille[c.y][c.x] == 0) {
|
||||
if(joueur1) {
|
||||
grille[c.y][c.x] = 1;
|
||||
keys[i].led.setPixelColor(0, 0,0,255);
|
||||
keys[i].led.show();
|
||||
if(victoire(grille, 1)) {
|
||||
Serial.println("Joueur 1 a gagne");
|
||||
affichResultat();
|
||||
}
|
||||
} else {
|
||||
grille[c.y][c.x] = 2;
|
||||
keys[i].led.setPixelColor(0, 255,0,0);
|
||||
keys[i].led.show();
|
||||
if(victoire(grille, 2)) {
|
||||
Serial.println("Joueur 2 a gagne");
|
||||
affichResultat();
|
||||
}
|
||||
}
|
||||
joueur1 = !joueur1;
|
||||
}
|
||||
joueur1 = !joueur1;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
menuWin();
|
||||
}
|
||||
lasttouched = currtouched;
|
||||
}
|
||||
@ -161,34 +208,88 @@ void localModeDuo(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtou
|
||||
void localModeSolo(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtouched) {
|
||||
currtouched = cap.touched();
|
||||
readButtonReset();
|
||||
if(!isWin){
|
||||
menuGame();
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
uint8_t t = keys[i].touchID;
|
||||
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
uint8_t t = keys[i].touchID;
|
||||
if ((currtouched & _BV(t)) && !(lasttouched & _BV(t))) {
|
||||
Serial.print("Touch "); Serial.print(t); Serial.println(" pressed");
|
||||
|
||||
if ((currtouched & _BV(t)) && !(lasttouched & _BV(t))) {
|
||||
Serial.print("Touch "); Serial.print(t); Serial.println(" pressed");
|
||||
Coord c = getCo(i);
|
||||
if(grille[c.y][c.x] == 0) {
|
||||
grille[c.y][c.x] = 1;
|
||||
keys[i].led.setPixelColor(0, 0,0,255);
|
||||
keys[i].led.show();
|
||||
if(victoire(grille, 1)) {
|
||||
Serial.println("Joueur 1 a gagne");
|
||||
affichResultat();
|
||||
}
|
||||
|
||||
Coord c = getCo(i);
|
||||
if(grille[c.y][c.x] == 0) {
|
||||
grille[c.y][c.x] = 1;
|
||||
afficheGrille();
|
||||
if(victoire(grille, 1)) {
|
||||
Serial.println("Joueur 1 a gagne");
|
||||
}
|
||||
int x, y;
|
||||
do {
|
||||
x = random(0, 3);
|
||||
y = random(0, 3);
|
||||
} while(grille[y][x] != 0);
|
||||
|
||||
int x, y;
|
||||
do {
|
||||
x = random(0, 3);
|
||||
y = random(0, 3);
|
||||
} while(grille[y][x] != 0);
|
||||
|
||||
grille[y][x] = 2;
|
||||
afficheGrille();
|
||||
if(victoire(grille, 2)) {
|
||||
Serial.println("Joueur 2 a gagne");
|
||||
}
|
||||
}
|
||||
grille[y][x] = 2;
|
||||
keys[i].led.setPixelColor(0, 255,0,0);
|
||||
keys[i].led.show();
|
||||
if(victoire(grille, 2)) {
|
||||
Serial.println("Joueur 2 a gagne");
|
||||
affichResultat();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
menuWin();
|
||||
}
|
||||
lasttouched = currtouched;
|
||||
}
|
||||
|
||||
|
||||
void affichResultat(){
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int j = 0; j < 3; j++) {
|
||||
if((i!=c1[0] || j!=c1[1]) && (i!=c2[0] || j!=c2[1]) && (i!=c3[0] || j!=c3[1])){
|
||||
keys[(3*i)+j].led.setPixelColor(0, 0,0,0);
|
||||
keys[(3*i)+j].led.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
isWin = true;
|
||||
}
|
||||
|
||||
|
||||
void turnOff(){
|
||||
for (int i = 0; i < numKeys; i++) {
|
||||
keys[i].led.setPixelColor(0, 0,0,0);
|
||||
keys[i].led.show();
|
||||
}
|
||||
}
|
||||
|
||||
void menuGame(){
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.println("Cliquer sur un boutonpour commencer");
|
||||
display.display();
|
||||
}
|
||||
|
||||
void menuWin(){
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
if(victoire(grille, 1)){
|
||||
display.println("Victoire du joueur 1");
|
||||
display.println();
|
||||
display.println("Cliquer sur le boutonreplay pour rejouer !");
|
||||
display.println("Cliquer sur le boutonreset pour revenir\nau menu !");
|
||||
}else{
|
||||
display.println("Victoire du joueur 2");
|
||||
display.println();
|
||||
display.println("Cliquer sur le boutonreplay pour rejouer !");
|
||||
display.println();
|
||||
display.println("Cliquer sur le boutonreset pour revenir\nau menu !");
|
||||
}
|
||||
display.display();
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ extern bool btns[9];
|
||||
extern bool joueur1;
|
||||
extern bool isBtnSet;
|
||||
|
||||
|
||||
Coord getCo(int key);
|
||||
bool victoire(int grille[3][3], int joueur);
|
||||
bool allInit();
|
||||
@ -36,6 +37,10 @@ void afficheGrille();
|
||||
void reset();
|
||||
void setBtn(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtouched);
|
||||
void readButtonReset();
|
||||
void affichResultat();
|
||||
void turnOff();
|
||||
void menuGame();
|
||||
void menuWin();
|
||||
|
||||
void localModeDuo(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtouched);
|
||||
void localModeSolo(Adafruit_MPR121& cap, uint16_t& lasttouched, uint16_t& currtouched);
|
||||
|
||||
41
menu.cpp
41
menu.cpp
@ -1,4 +1,5 @@
|
||||
#include "menu.h"
|
||||
#include "localMode.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
// Variables de configuration du menu
|
||||
@ -11,27 +12,28 @@ uint8_t btnPrevB;
|
||||
uint8_t btnA;
|
||||
uint8_t btnB;
|
||||
|
||||
bool isMod = false;
|
||||
bool isModJeu = false;
|
||||
bool isDifficulty = false;
|
||||
uint8_t isMod = false;
|
||||
uint8_t isModJeu = false;
|
||||
uint8_t isDifficulty = false;
|
||||
bool isPlay = false;
|
||||
bool isWebSet = false;
|
||||
|
||||
|
||||
Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire);
|
||||
|
||||
unsigned long lastDebounceTimeA = 0;
|
||||
unsigned long lastDebounceTimeB = 0;
|
||||
const unsigned long debounceDelay = 200;
|
||||
|
||||
// Assure-toi que epd_bitmap_logo soit déclaré ailleurs ou inclus ici
|
||||
|
||||
//extern const unsigned char epd_bitmap_logo[];
|
||||
|
||||
void setupMenu() {
|
||||
pinMode(BUTTON_A, INPUT_PULLUP);
|
||||
pinMode(BUTTON_B, INPUT_PULLUP);
|
||||
|
||||
btnPrevA = digitalRead(BUTTON_A);
|
||||
btnPrevB = digitalRead(BUTTON_B);
|
||||
btnPrevA = 0x0;
|
||||
btnPrevB = 0x0;
|
||||
|
||||
display.begin(0x3C, true);
|
||||
display.clearDisplay();
|
||||
@ -50,7 +52,7 @@ void setupMenu() {
|
||||
void choixMode() {
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.print("Choisissez le mode :\n");
|
||||
display.print("Choisir le mode :\n");
|
||||
display.print("[A] Local\n");
|
||||
display.print("[B] Web\n");
|
||||
display.display();
|
||||
@ -59,7 +61,7 @@ void choixMode() {
|
||||
void choixModeJeu() {
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.print("Choisissez le type :\n");
|
||||
display.print("Choisir le type :\n");
|
||||
display.print("[A] Solo\n");
|
||||
display.print("[B] Duo\n");
|
||||
display.display();
|
||||
@ -68,35 +70,36 @@ void choixModeJeu() {
|
||||
void choixDifficulty() {
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.print("Choisissez la \ndifficulte :\n");
|
||||
display.print("Choisir la \ndifficulte :\n");
|
||||
display.print("[A] Debutant\n");
|
||||
display.print("[B] Expert\n");
|
||||
display.display();
|
||||
}
|
||||
|
||||
void menu() {
|
||||
|
||||
if (!isMod) {
|
||||
choixMode();
|
||||
} else if (local && !isModJeu) {
|
||||
choixModeJeu();
|
||||
} else if (local && solo && !isDifficulty) {
|
||||
choixDifficulty();
|
||||
} else {
|
||||
} else{
|
||||
isPlay = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void handleButtonA() {
|
||||
if (!isMod) {
|
||||
local = true;
|
||||
isMod = true;
|
||||
} else if (!isModJeu) {
|
||||
} else if (local && !isModJeu) {
|
||||
solo = true;
|
||||
isModJeu = true;
|
||||
} else if (solo && !isDifficulty) {
|
||||
} else if (local && solo && !isDifficulty) {
|
||||
difficulty = 1;
|
||||
isDifficulty = true;
|
||||
isPlay = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,18 +107,24 @@ void handleButtonB() {
|
||||
if (!isMod) {
|
||||
local = false;
|
||||
isMod = true;
|
||||
} else if (!isModJeu) {
|
||||
} else if (local && !isModJeu) {
|
||||
solo = false;
|
||||
isModJeu = true;
|
||||
} else if (solo && !isDifficulty) {
|
||||
} else if (local && solo && !isDifficulty) {
|
||||
difficulty = 2;
|
||||
isDifficulty = true;
|
||||
isPlay = true;
|
||||
}
|
||||
}
|
||||
|
||||
void readButton() {
|
||||
btnA = digitalRead(BUTTON_A);
|
||||
/*
|
||||
Serial.print(btnA);
|
||||
Serial.print(" ");
|
||||
Serial.println(btnPrevA);
|
||||
delay(1000);
|
||||
*/
|
||||
|
||||
if (btnA == LOW && btnPrevA == HIGH && (millis() - lastDebounceTimeA > debounceDelay)) {
|
||||
lastDebounceTimeA = millis();
|
||||
handleButtonA();
|
||||
|
||||
5
menu.h
5
menu.h
@ -4,7 +4,6 @@
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SH110X.h>
|
||||
|
||||
// Variables de configuration du menu
|
||||
extern bool local;
|
||||
extern bool solo;
|
||||
extern int difficulty;
|
||||
@ -14,9 +13,7 @@ extern uint8_t btnPrevB;
|
||||
extern uint8_t btnA;
|
||||
extern uint8_t btnB;
|
||||
|
||||
extern bool isMod;
|
||||
extern bool isModJeu;
|
||||
extern bool isDifficulty;
|
||||
|
||||
extern bool isPlay;
|
||||
extern bool isWebSet;
|
||||
|
||||
|
||||
21
musique.cpp
Normal file
21
musique.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include "musique.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
int BassTab[]={1911,1702,1516,1431,1275,1136,1012};//bass 1~7
|
||||
|
||||
|
||||
void pinInit()
|
||||
{
|
||||
pinMode(SPEAKER,OUTPUT);
|
||||
digitalWrite(SPEAKER,LOW);
|
||||
}
|
||||
void sound(uint8_t note_index)
|
||||
{
|
||||
for(int i=0;i<100;i++)
|
||||
{
|
||||
digitalWrite(SPEAKER,HIGH);
|
||||
delayMicroseconds(BassTab[note_index]);
|
||||
digitalWrite(SPEAKER,LOW);
|
||||
delayMicroseconds(BassTab[note_index]);
|
||||
}
|
||||
}
|
||||
15
musique.h
Normal file
15
musique.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef MUSIQUE_H
|
||||
#define MUSIQUE_H
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#define SPEAKER 19
|
||||
|
||||
//#define I2C2_SDA2 19
|
||||
//#define I2C2_SCL2 18
|
||||
|
||||
|
||||
void pinInit();
|
||||
void sound(uint8_t note_index);
|
||||
|
||||
#endif // MUSIQUE_H
|
||||
3
pin.h
3
pin.h
@ -11,4 +11,5 @@
|
||||
#define RX 16
|
||||
#define TX 17
|
||||
#define SCL 22
|
||||
#define SDA 23
|
||||
#define SDA 23
|
||||
#define VART 0
|
||||
13
web.cpp
13
web.cpp
@ -5,10 +5,9 @@
|
||||
|
||||
extern Adafruit_SH1107 display;
|
||||
|
||||
// Utilisateurs du réseau
|
||||
const char *ssid = "morpion-SAE";
|
||||
const char *password = "12345678";
|
||||
NetworkServer server(80);
|
||||
WiFiServer server(80);
|
||||
|
||||
void setupWeb() {
|
||||
Serial.println();
|
||||
@ -26,18 +25,18 @@ void setupWeb() {
|
||||
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.println("Connectez vous a :");
|
||||
display.println("Connectez-vous a :");
|
||||
display.print("Nom : ");
|
||||
display.println(ssid);
|
||||
display.print("Mdp : ");
|
||||
display.println(password);
|
||||
display.println();
|
||||
display.print("Puis accedez a \nl'adresse ");
|
||||
display.print("Puis accedez a\nl'adresse ");
|
||||
display.print(myIP);
|
||||
display.display();
|
||||
}
|
||||
|
||||
void webGame(NetworkClient &c){
|
||||
void webGame(WiFiClient &c) {
|
||||
c.println(R"rawliteral(
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -286,7 +285,7 @@ void webGame(NetworkClient &c){
|
||||
}
|
||||
|
||||
void loopWeb() {
|
||||
NetworkClient client = server.accept();
|
||||
WiFiClient client = server.available();
|
||||
if (client) {
|
||||
Serial.println("New Client.");
|
||||
String currentLine = "";
|
||||
@ -313,4 +312,4 @@ void loopWeb() {
|
||||
client.stop();
|
||||
Serial.println("Client Disconnected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
10
web.h
10
web.h
@ -2,19 +2,17 @@
|
||||
#define WEBSERVER_H
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <NetworkClient.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WiFiAP.h>
|
||||
|
||||
// SSID & mot de passe du réseau WiFi
|
||||
extern const char *ssid;
|
||||
extern const char *password;
|
||||
|
||||
// Serveur et client web
|
||||
extern NetworkServer server;
|
||||
extern WiFiServer server;
|
||||
|
||||
void setupWeb();
|
||||
void loopWeb();
|
||||
void webGame(NetworkClient &c);
|
||||
void webSolo(NetworkClient &c);
|
||||
void webGame(WiFiClient &c);
|
||||
void webSolo(WiFiClient &c);
|
||||
|
||||
#endif // WEBSERVER_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user