HL 21 Le cube : Différence entre versions
Ligne 55 : | Ligne 55 : | ||
[[Fichier:Sieste.jpg|200px|thumb|left|icon sieste]] | [[Fichier:Sieste.jpg|200px|thumb|left|icon sieste]] | ||
+ | <code> | ||
+ | /** | ||
+ | Rework par 071V13R au HP 21 @Fab à Brest | ||
+ | |||
+ | The MIT License (MIT) | ||
+ | |||
+ | Copyright (c) 2018 by ThingPulse, Daniel Eichhorn | ||
+ | Copyright (c) 2018 by Fabrice Weinberg | ||
+ | |||
+ | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
+ | of this software and associated documentation files (the "Software"), to deal | ||
+ | in the Software without restriction, including without limitation the rights | ||
+ | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
+ | copies of the Software, and to permit persons to whom the Software is | ||
+ | furnished to do so, subject to the following conditions: | ||
+ | |||
+ | The above copyright notice and this permission notice shall be included in all | ||
+ | copies or substantial portions of the Software. | ||
+ | |||
+ | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
+ | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
+ | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
+ | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
+ | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
+ | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
+ | SOFTWARE. | ||
+ | |||
+ | ThingPulse invests considerable time and money to develop these open source libraries. | ||
+ | Please support us by buying our products (and not the clones) from | ||
+ | https://thingpulse.com | ||
+ | |||
+ | Tuto pour le wemos : https://www.teachmemicro.com/1-3-i2c-oled-arduino-esp8266-tutorial/ | ||
+ | attention inverser SDA / SDK | ||
+ | |||
+ | */ | ||
+ | |||
+ | // Include the correct display library | ||
+ | |||
+ | // For a connection via I2C using the Arduino Wire include: | ||
+ | #include <Wire.h> // Only needed for Arduino 1.6.5 and earlier | ||
+ | #include"SH1106.h" // WEMOS | ||
+ | |||
+ | // Logo icone image | ||
+ | #include "sieste.h" | ||
+ | #include "activite.h" | ||
+ | #include "arrivee.h" | ||
+ | #include "gouter.h" | ||
+ | #include "repas.h" | ||
+ | #include "depart.h" | ||
+ | #include "rangement.h" | ||
+ | |||
+ | |||
+ | // Initialize the OLED display using Arduino Wire: | ||
+ | SH1106 display(0x3C,D1,D2); //WEMOS attenion inversion branchement par rapport au tuto | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | Serial.println(); | ||
+ | |||
+ | // Initialising the UI will init the display too. | ||
+ | display.init(); | ||
+ | //display.flipScreenVertically(); | ||
+ | Serial.print ("Fin du setup"); | ||
+ | |||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | |||
+ | // clear the display | ||
+ | |||
+ | display.clear(); | ||
+ | |||
+ | // routine de lancement | ||
+ | |||
+ | // affichage de "Bonjour" | ||
+ | display.setTextAlignment(TEXT_ALIGN_LEFT); | ||
+ | display.setFont(ArialMT_Plain_16); | ||
+ | display.drawString(0, 0, "Bonjour"); | ||
+ | display.display(); | ||
+ | delay (1000); | ||
+ | display.clear(); | ||
+ | |||
+ | // affichage de "la journée commence bien avec le Cube" | ||
+ | display.setFont(ArialMT_Plain_10); | ||
+ | display.setTextAlignment(TEXT_ALIGN_LEFT); | ||
+ | display.drawStringMaxWidth(0, 0, 128,"La journée commence bien avec le Cube." ); | ||
+ | display.display(); | ||
+ | delay (1000); | ||
+ | display.clear(); | ||
+ | |||
+ | // affichage de "c'est parti" | ||
+ | display.setFont(ArialMT_Plain_10); | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(64, 22, "C'est parti."); | ||
+ | display.display(); | ||
+ | delay (1000); | ||
+ | display.clear(); | ||
+ | |||
+ | // phase d'accueil | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(45,0, arrivee_width, arrivee_height, arrivee_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase rangement rassemblement | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase d activité | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(50,0, activite_width, activite_height, activite_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase rangement rassemblement | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase de repas | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(50,0, repas_width, repas_height, repas_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase rangement rassemblement | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase de sieste | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(45,0, sieste_width, sieste_height, sieste_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase rangement rassemblement | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase de gouter | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(45,0, gouter_width, gouter_height, gouter_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase d activité | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(50,0, activite_width, activite_height, activite_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | // phase de depart | ||
+ | |||
+ | for (int t=0; t<100; t++) | ||
+ | { | ||
+ | display.drawXbm(35,0, depart_width, depart_height, depart_bits); | ||
+ | display.drawProgressBar(5, 50, 120, 10, t); | ||
+ | int progress = t; | ||
+ | display.setTextAlignment(TEXT_ALIGN_CENTER); | ||
+ | display.drawString(65, 32, String(progress) + "%"); | ||
+ | display.display(); | ||
+ | delay (25); | ||
+ | display.clear(); | ||
+ | } | ||
+ | |||
+ | |||
+ | } | ||
+ | </code> | ||
[[Catégorie:HP21 Lumière]] | [[Catégorie:HP21 Lumière]] | ||
[[Catégorie:Hackathon Pédagogique]] | [[Catégorie:Hackathon Pédagogique]] |
Version du 7 décembre 2021 à 16:02
HP 21 lumière : Le cube
Le Cube
Sources d’inspiration :
https://www.instructables.com/Concrete-LED-Light-Cube/ https://www.instructables.com/LED-Cube-Light/ https://www.instructables.com/Awesome-led-cube/
Participants : Yann, Patrick, Pierre, Olivier
Sur un idée de Yann, nous partons sur l’idée d’un cube qui va aider les enfants à prendre connaissance du rythme de la journée tel qu’il est fixé par les adultes. L’idée est de fournir des repères aux enfants en toute autonomie. En fonction des temps de la journée le cube éclairera d’une certaine couleur.
Les temps de la journée sont :
• Accueil arrivée • Rangement • Activité • Rangement rassemblement • Repas • Temps sieste • Activité • Goûter • Accueil départ
Liste de matériel :
- feuille de calque
- led patate
- interrupteur
- wemos
- led rgb
- batterie 18650
- shield batterie
- clock shield
- ecran
- bois picto
to do interface web
/**
Rework par 071V13R au HP 21 @Fab à Brest The MIT License (MIT)
Copyright (c) 2018 by ThingPulse, Daniel Eichhorn Copyright (c) 2018 by Fabrice Weinberg
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ThingPulse invests considerable time and money to develop these open source libraries. Please support us by buying our products (and not the clones) from https://thingpulse.com
Tuto pour le wemos : https://www.teachmemicro.com/1-3-i2c-oled-arduino-esp8266-tutorial/ attention inverser SDA / SDK
- /
// Include the correct display library
// For a connection via I2C using the Arduino Wire include:
- include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
- include"SH1106.h" // WEMOS
// Logo icone image
- include "sieste.h"
- include "activite.h"
- include "arrivee.h"
- include "gouter.h"
- include "repas.h"
- include "depart.h"
- include "rangement.h"
// Initialize the OLED display using Arduino Wire:
SH1106 display(0x3C,D1,D2); //WEMOS attenion inversion branchement par rapport au tuto
void setup() {
Serial.begin(115200); Serial.println();
// Initialising the UI will init the display too. display.init(); //display.flipScreenVertically(); Serial.print ("Fin du setup");
}
void loop() {
// clear the display display.clear();
// routine de lancement
// affichage de "Bonjour"
display.setTextAlignment(TEXT_ALIGN_LEFT); display.setFont(ArialMT_Plain_16); display.drawString(0, 0, "Bonjour"); display.display(); delay (1000); display.clear();
// affichage de "la journée commence bien avec le Cube"
display.setFont(ArialMT_Plain_10); display.setTextAlignment(TEXT_ALIGN_LEFT); display.drawStringMaxWidth(0, 0, 128,"La journée commence bien avec le Cube." ); display.display(); delay (1000); display.clear();
// affichage de "c'est parti"
display.setFont(ArialMT_Plain_10); display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(64, 22, "C'est parti."); display.display(); delay (1000); display.clear();
// phase d'accueil
for (int t=0; t<100; t++) {
display.drawXbm(45,0, arrivee_width, arrivee_height, arrivee_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase rangement rassemblement
for (int t=0; t<100; t++) {
display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase d activité
for (int t=0; t<100; t++) {
display.drawXbm(50,0, activite_width, activite_height, activite_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase rangement rassemblement
for (int t=0; t<100; t++) {
display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase de repas
for (int t=0; t<100; t++) {
display.drawXbm(50,0, repas_width, repas_height, repas_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase rangement rassemblement
for (int t=0; t<100; t++) {
display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase de sieste
for (int t=0; t<100; t++) {
display.drawXbm(45,0, sieste_width, sieste_height, sieste_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase rangement rassemblement
for (int t=0; t<100; t++) {
display.drawXbm(48,0, rangement_width, rangement_height, rangement_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase de gouter
for (int t=0; t<100; t++) {
display.drawXbm(45,0, gouter_width, gouter_height, gouter_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase d activité
for (int t=0; t<100; t++) {
display.drawXbm(50,0, activite_width, activite_height, activite_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
// phase de depart
for (int t=0; t<100; t++) {
display.drawXbm(35,0, depart_width, depart_height, depart_bits); display.drawProgressBar(5, 50, 120, 10, t); int progress = t; display.setTextAlignment(TEXT_ALIGN_CENTER); display.drawString(65, 32, String(progress) + "%"); display.display(); delay (25); display.clear();
}
}