diff --git a/Debug/0x00_debug/0x00_debug.ino b/Debug/0x00_debug/0x00_debug.ino new file mode 100644 index 0000000..a40bd22 --- /dev/null +++ b/Debug/0x00_debug/0x00_debug.ino @@ -0,0 +1,16 @@ +int inQuery; + +void setup() { + Serial.begin(9600); +} + +void loop() { + + if ( Serial.available() > 0) { + inQuery = Serial.read(); + Serial.print("Decimal: "); + Serial.println(inQuery); + Serial.print("Hexadecimal: "); + Serial.println(inQuery, HEX); + } +} diff --git a/Debug/README.md b/Debug/README.md index 113c179..b0fe1bf 100644 --- a/Debug/README.md +++ b/Debug/README.md @@ -1,8 +1,10 @@ -### Protoboard +### 1. Protoboard Montar componentes según la imagen. -![protoboard](proto.png) +**IMPORTANTE:** El pin `Tx` del Arduino no está conectado al diodo. + +![protoboard](proto_01.png) El protoboard se confecciono según el circuito impreso. @@ -10,3 +12,110 @@ El protoboard se confecciono según el circuito impreso. +### 2. Firmware + +Cargar el fichero `0x00_debug/0x00_debug.ino` en el Arduino 0x01. + +Fichero `0x00_debug.ino`. + +``` +int inQuery; + +void setup() { + Serial.begin(9600); +} + +void loop() { + + if ( Serial.available() > 0) { + inQuery = Serial.read(); + Serial.print("Decimal: "); + Serial.println(inQuery); + Serial.print("Hexadecimal: "); + Serial.println(inQuery, HEX); + } +} +``` + + + +### 4. Raspbian + +**Paso 1.** + +Hacer una instalación fresca del sistema operativo (version lite). + +**Paso 2.** + +Configurar SO. + +``` +$ sudo raspi-config +``` + +Seguir el siguiente patrón de opciones: + +3 Interface Options > I6 Serial Port > Would you like a login shell to be accessible over serial? \ > Would you like the serial port hardware to be enabled? \. > Seleccionar \ > Seleccionar \ > Would you like to reboot now? \. + +**Paso 3.** + +Instalar 'pyserial'. + +``` +$ sudo apt update && sudo apt upgrade +$ sudo apt install python3-pip +$ sudo pip3 install pyserial +``` + +**Paso 4.** + +Clonar repositorio. + +``` +$ git clone https://gitea.nulo.in/Nodemecu/nodemecu.git +``` + +Entrar al directorio de trabajo. + +``` +$ cd nodemecu +``` + +Cambiar a rama testing. + +``` +$ git checkout testing +``` + +Verificar. + +``` +$ git branch + master + placa +* testing +``` + +Entrar al directorio `Debug`. + +``` +$ cd Debug +``` + +**Paso 5.** + +En la computadora, desde el Arduino IDE, abrir el monitor serial. + +Enviar caracteres por serial (interrumpir el comando con ctrl-c). + +``` +$ sudo python arduinos.py 1 + +``` + +En el monitor Arduino debería imprimirse lo siguiente. + +![](monitor_01.png) + +Probar con otros numeros + diff --git a/Debug/arduinos.py b/Debug/arduinos.py new file mode 100644 index 0000000..9b4f0df --- /dev/null +++ b/Debug/arduinos.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +import time +import serial +import sys + + +ser = serial.Serial( + port='/dev/serial0', #Replace ttyS0 with ttyAM0 for Pi1,Pi2,Pi0 + baudrate = 9600, + parity=serial.PARITY_NONE, + stopbits=serial.STOPBITS_ONE, + bytesize=serial.EIGHTBITS, + timeout=1 +) + +ser.flush() + +cw = int(sys.argv[1], 0) +com = [cw] +ser.write(serial.to_bytes(com)) +ser.flush() +while True: + if ser.in_waiting > 0: + line = ser.readline().decode('utf-8', errors='replace').rstrip() + #time.sleep(0.1) + print(line) + ser.flush() + break + +quit() diff --git a/Debug/monitor_01.png b/Debug/monitor_01.png new file mode 100644 index 0000000..957d12c Binary files /dev/null and b/Debug/monitor_01.png differ diff --git a/Debug/proto.png b/Debug/proto.png index 8c3a68c..aac6c9c 100644 Binary files a/Debug/proto.png and b/Debug/proto.png differ diff --git a/Debug/proto_01.png b/Debug/proto_01.png new file mode 100644 index 0000000..1b678e4 Binary files /dev/null and b/Debug/proto_01.png differ