tecnologia:proyectos:atril
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tecnologia:proyectos:atril [2022/12/28 17:56] – admin | tecnologia: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| | ||
| + | |||
| < | < | ||
| #include < | #include < | ||
| #include < | #include < | ||
| - | #include < | + | #include < |
| - | #include < | + | |
| #include < | #include < | ||
| - | #include < | ||
| #include < | #include < | ||
| Line 27: | Line 32: | ||
| AsyncWebServer server(80); | AsyncWebServer server(80); | ||
| - | const int lectura=5; | + | MD_Parola Display |
| - | String | + | String |
| String serverPath = " | String serverPath = " | ||
| + | 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 | ||
| - | MD_Parola Display = MD_Parola(HARDWARE_TYPE, | ||
| void setup() { | void setup() { | ||
| - | |||
| Display.begin(); | Display.begin(); | ||
| Display.setIntensity(0); | Display.setIntensity(0); | ||
| Display.displayClear(); | Display.displayClear(); | ||
| + | Display.displayScroll(" | ||
| + | |||
| Serial.begin(115200); | Serial.begin(115200); | ||
| delay(10); | delay(10); | ||
| Line 49: | Line 57: | ||
| while (WiFi.status() != WL_CONNECTED) { | while (WiFi.status() != WL_CONNECTED) { | ||
| - | | + | |
| - | | + | |
| + | } | ||
| } | } | ||
| Line 56: | Line 65: | ||
| Serial.println(" | Serial.println(" | ||
| Serial.print(" | Serial.print(" | ||
| - | Serial.println(WiFi.localIP()); | + | Serial.println(WiFi.localIP()); |
| server.on("/", | server.on("/", | ||
| - | request-> | + | request-> |
| }); | }); | ||
| | | ||
| | | ||
| - | AsyncElegantOTA.begin(& | + | AsyncElegantOTA.begin(& |
| server.begin(); | server.begin(); | ||
| Serial.println(" | Serial.println(" | ||
| - | Display.print(" | ||
| delay(1000); | delay(1000); | ||
| - | } | + | my_ip = WiFi.localIP().toString(); |
| + | Serial.println(my_ip); | ||
| + | Display.displayClear(); | ||
| + | Display.displayScroll(my_ip.c_str(), | ||
| + | | ||
| + | |||
| + | Serial.println(my_ip); | ||
| + | |||
| + | for (int muestra_ip = 1; muestra_ip <= 2; muestra_ip++) { | ||
| + | while (true) { | ||
| + | if (Display.displayAnimate()) { | ||
| + | Display.displayReset(); | ||
| + | break; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | pinMode(pinCoin, | ||
| + | |||
| + | } | ||
| void loop() { | void loop() { | ||
| - | AsyncElegantOTA.loop(); | ||
| - | Display.setTextAlignment(PA_LEFT); | + | lectura = digitalRead(pinCoin); |
| + | Serial.println(lectura); | ||
| + | if (lectura==1) | ||
| + | mensaje(); | ||
| + | else // si no | ||
| + | delay(50); // esperamos solo 50 milisegundos para que la siguiente lectura sea muy seguida | ||
| + | |||
| + | } | ||
| - | if(WiFi.status()== WL_CONNECTED){ | + | void mensaje(){ |
| + | | ||
| HTTPClient http; | HTTPClient http; | ||
| | | ||
| Line 91: | Line 125: | ||
| String payload = http.getString(); | String payload = http.getString(); | ||
| Serial.println(payload); | Serial.println(payload); | ||
| - | | + | |
| - | | + | Serial.println(payload.length()); |
| - | Display.setTextAlignment(PA_LEFT); | + | |
| - | | + | |
| + | |||
| + | //Frase sin caracter final | ||
| + | Display.displayClear(); | ||
| + | Display.displayScroll(cadena.c_str(), | ||
| + | | ||
| + | if (Display.displayAnimate()) { | ||
| + | Display.displayReset(); | ||
| + | break; | ||
| + | } | ||
| + | } | ||
| + | |||
| } | } | ||
| else { | else { | ||
| Line 102: | Line 148: | ||
| // Free resources | // Free resources | ||
| http.end(); | http.end(); | ||
| - | } | + | |
| - | else { | + | |
| - | Serial.println(" | + | |
| - | } | + | |
| - | + | ||
| - | power = ""; | + | |
| - | delay(10000); | + | |
| } | } | ||
| + | |||
| </ | </ | ||
tecnologia/proyectos/atril.1672250219.txt.gz · Last modified: by admin
