Compare commits

...

2 commits

Author SHA1 Message Date
Sergio Pernas 0843aea109 update 2022-08-23 14:25:59 -03:00
Sergio Pernas 68314e4c82 debug 2022-08-23 13:28:29 -03:00
6 changed files with 157 additions and 2 deletions

View file

@ -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);
}
}

View file

@ -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? \<No\> > Would you like the serial port hardware to be enabled? \<Yes\>. > Seleccionar \<Ok\> > Seleccionar \<Finish\> > Would you like to reboot now? \<Yes\>.
**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

30
Debug/arduinos.py Normal file
View file

@ -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()

BIN
Debug/monitor_01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 295 KiB

BIN
Debug/proto_01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB