Actualización de Flujos de desbloqueo
This commit is contained in:
parent
350d75323e
commit
6d41fa23b6
@ -15,7 +15,12 @@
|
|||||||
https://git.koneko.mx/Koneko-EM/pcb-tinyboard-atmega328p-au
|
https://git.koneko.mx/Koneko-EM/pcb-tinyboard-atmega328p-au
|
||||||
|
|
||||||
|
|
||||||
### Flojo de operación
|
### Flujo de operación
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
### Desbloqueo paro de motor
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
BIN
flujo-de-operacion/flujo-de-operacion-prorroga-para-de-motor.png
Normal file
BIN
flujo-de-operacion/flujo-de-operacion-prorroga-para-de-motor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
BIN
flujo-de-operacion/loop-desbloqueo-prorroga-paro-de-motor.dia
Normal file
BIN
flujo-de-operacion/loop-desbloqueo-prorroga-paro-de-motor.dia
Normal file
Binary file not shown.
BIN
flujo-de-operacion/loop-desbloqueo-prorroga-paro-de-motor.png
Normal file
BIN
flujo-de-operacion/loop-desbloqueo-prorroga-paro-de-motor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user