User Tools

Site Tools


tecnologia:proyectos:atril

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tecnologia:proyectos:atril [2022/12/28 19:06] – admintecnologia:proyectos:atril [2022/12/29 03:56] (current) – admin
Line 1: Line 1:
 +^PANEL^ESP32^
 +|VCC|Vin|
 +|GND|GND|
 +|DIN|GPIO23|
 +|CS|GPIO5|
 +|CLK|GPIO18|
 +
 <code> <code>
 #include <MD_Parola.h> #include <MD_Parola.h>
Line 29: Line 36:
 String serverPath = "http://bateriaseko.lobo99.com/frases"; String serverPath = "http://bateriaseko.lobo99.com/frases";
 String payload =""; String payload ="";
 +
 +int pinCoin = 15;   // pin de la Arduino donde conectamos la salida COIN del detector de monedas
 +int lectura = 0;   // variable para almacenar lo que leemos del pin COIN
 +
  
 void setup() { void setup() {
Line 57: Line 68:
  
   server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {   server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
-    request->send(200, "text/plain", "V1.0 Prueba Panel Led");+    request->send(200, "text/plain", "V1.0  Atril");
   });   });
      
Line 84: Line 95:
   }   }
  
 +  pinMode(pinCoin,INPUT);   // pinCoin es una entrada de información
  
 } }
 void loop() { void loop() {
 +
 +  lectura = digitalRead(pinCoin);   // leemos el pinCoin
 +  Serial.println(lectura);          // escribimos la lectura en el puerto serie
 +  if (lectura==1)                   // si detecta moneda
 +    mensaje();                     // esperamos un segundo, para que no nos de muchos unos seguidos
 +  else                              // si no
 +    delay(50);                       // esperamos solo 50 milisegundos para que la siguiente lectura sea muy seguida
 +  
 +}
 +
 +
 +void mensaje(){
 +  
       HTTPClient http;       HTTPClient http;
              
Line 103: Line 128:
         Serial.println(payload.length());         Serial.println(payload.length());
         int largo = payload.length();         int largo = payload.length();
-        String cadena = payload.substring(largo-1); +        String cadena = payload.substring(0,largo-1); 
-          + 
-        //Frase entera con caracter al final+        //Frase sin caracter final
         Display.displayClear();         Display.displayClear();
-        Display.displayScroll(payload.c_str(), PA_CENTER, PA_SCROLL_LEFT, 25);+        Display.displayScroll(cadena.c_str(), PA_CENTER, PA_SCROLL_LEFT, 25);
         while (true) {           while (true) {  
         if (Display.displayAnimate()) {         if (Display.displayAnimate()) {
Line 115: Line 140:
         }         }
  
-        Display.setTextAlignment(PA_LEFT); +
-        delay(1000);+
       }       }
       else {       else {
Line 124: Line 148:
       // Free resources       // Free resources
       http.end();       http.end();
-  Display.print(payload); 
-  delay(1000); 
- 
-  Display.displayClear(); 
-  Display.print("fijo"); 
-  delay(1000); 
  
 } }
  
 </code> </code>
tecnologia/proyectos/atril.1672254377.txt.gz · Last modified: by admin