Actualización de Flujos de desbloqueo

This commit is contained in:
Arturo Corro 2021-07-02 20:23:16 -05:00
parent 350d75323e
commit 6d41fa23b6
5 changed files with 106 additions and 2 deletions

View File

@ -15,7 +15,12 @@
https://git.koneko.mx/Koneko-EM/pcb-tinyboard-atmega328p-au
### Flojo de operación
### Flujo de operación
![](https://git.koneko.mx/Koneko-EM/prorroga-paro-de-motor-atmel/raw/branch/main/flujo-de-operacion/flujo-de-operacion-prorroga-para-de-motor.jpeg)
![](https://git.koneko.mx/Koneko-EM/prorroga-paro-de-motor-atmel/raw/branch/main/flujo-de-operacion/prorroga-paro-de-motor-atmel.png)
### Desbloqueo paro de motor
![](https://git.koneko.mx/Koneko-EM/prorroga-paro-de-motor-atmel/raw/branch/main/loop-desbloqueo-prorroga-paro-de-motor.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,99 @@
/*****************************************
* Prorroga paro de motor - ATMEGA328P *
* PLACA Tinyboard ATmega328P-AU *
* 05/06/2021 *
* Versión 0.1.0 *
*****************************************/
// https://git.koneko.mx/Koneko-EM/prorroga-paro-de-motor-atmel
#include <EEPROM.h>
/**************************************************
* Definición de Constantes
**************************************************/
// PINOUT
#define JAMMER_DETECTION A5 // Cables naranja 1012 -114
#define BUTTON_LOCKOUT_EXTENSION A3 // Cable amarillo
#define BUTTON_UNLOCK A4 // Cable morado - 116 / rosa 139
#define INDICATOR_LIGHT 3 // Cable café
#define ENGINE_STOP_RELAY 5 // Cable verde
// ANALOG UNLOCKING VALUES
#define BUTTON_UNLOCK_LOW 116
#define BUTTON_UNLOCK_HIGH 139
/**************************************************
* Debug
* Define DEBUG_SERIAL_ENABLE to enable debug serial.
* Comment it to disable debug serial.
**************************************************/
#define DEBUG_SERIAL_ENABLE
#define dbSerial Serial
#ifdef DEBUG_SERIAL_ENABLE
#define serialPrint(a) dbSerial.print(a)
#define serialPrintln(a) dbSerial.println(a)
#define serialBegin(a) dbSerial.begin(a)
#define serialBeginWhile(a) while(!dbSerial) delay(1)
#else
#define serialPrint(a) do{}while(0)
#define serialPrintln(a) do{}while(0)
#define serialBegin(a) do{}while(0)
#define serialBeginWhile(a) do{}while(0)
#endif
uint8_t jammer_detection_val;
uint8_t lockout_extension_val;
uint16_t unlock_val;
void setup() {
pinMode(JAMMER_DETECTION, INPUT_PULLUP);
pinMode(BUTTON_LOCKOUT_EXTENSION, INPUT_PULLUP);
pinMode(BUTTON_UNLOCK, INPUT_PULLUP);
pinMode(INDICATOR_LIGHT, OUTPUT);
pinMode(ENGINE_STOP_RELAY, OUTPUT);
// Salida Serial
serialBegin(9600);
serialBeginWhile();
}
void loop() {
jammer_detection_val = digitalRead(JAMMER_DETECTION);
lockout_extension_val = digitalRead(BUTTON_LOCKOUT_EXTENSION);
unlock_val = analogRead(BUTTON_UNLOCK);
if(!jammer_detection_val)
serialPrintln("JAMMER DETECTED");
if(!lockout_extension_val)
serialPrintln("PRORROGA");
if(unlock_val >= BUTTON_UNLOCK_LOW -3 && unlock_val <= BUTTON_UNLOCK_LOW +3)
serialPrintln("UNLOCK IZQUIERDA");
if(unlock_val >= BUTTON_UNLOCK_HIGH -3 && unlock_val <= BUTTON_UNLOCK_HIGH +3)
serialPrintln("UNLOCK DERECHA");
delay(250);
}