comenzando desde cero (Starting from scratch)

What are you working on .... Show off your Rov's Projects here.
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenos días.

He realizado el cambio de poner la macro "(F())", en todos los Serial.print del Maestro, solo en las lineas de texto, y la diferencia es considerable, ahora al compilar pone esto.

Good morning.

I've made the change from putting the macro "(F())", on all the Master's Serial.print, only in the lines of text, and the difference is considerable, now when compiling puts this.

Code: Select all

El Sketch usa 12086 bytes (4%) del espacio de almacenamiento de programa. El máximo es 253952 bytes.
Las variables Globales usan 650 bytes (7%) de la memoria dinámica, dejando 7542 bytes para las variables locales. El máximo es 8192 bytes.

Code: Select all

 Sketch uses 12086 bytes (4%) of the program storage space. The maximum is 253952 bytes.
Global variables use 650 bytes (7%) dynamic memory, leaving 7542 bytes for local variables. The maximum is 8192 bytes.

Voy a realizar el cambio en el Esclavo, a ver que pasa.

Un saludo



I'm going to make the change in the Slave, see what happens.

A greeting
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Ahora el esclavo al compilar pone esto.

Code: Select all

El Sketch usa 15920 bytes (6%) del espacio de almacenamiento de programa. El máximo es 253952 bytes.
Las variables Globales usan 1012 bytes (12%) de la memoria dinámica, dejando 7180 bytes para las variables locales. El máximo es 8192 bytes.



Now the slave when compiling puts this.

Code: Select all

Sketch uses 15920 bytes (6%) of the program storage space. The maximum is 253952 bytes.
Global variables use 1012 bytes (12%) dynamic memory, leaving 7180 bytes for local variables. The maximum is 8192 bytes.

Por lo que también hay una diferencia considerable en la memoria utilizada.

So there is also a considerable difference in the memory used.
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Seguimos igual que antes el mando de PS2, sigue sin mandar ninguna orden al Esclavo.

We continue as before the PS2 command, still do not send any orders to the Slave
Attachments
RC_ESC-master.rar
Librería
(17.25 KiB) Downloaded 247 times
MPU6050.rar
Librería
(96.06 KiB) Downloaded 241 times
OneWire.rar
Librería
(19.45 KiB) Downloaded 218 times
DHT.rar
Librería
(1.71 KiB) Downloaded 231 times
Adafruit_ADXL343.rar
Librería
(11.84 KiB) Downloaded 232 times
Adafruit_Circuit_Playground.rar
Librería
(448.5 KiB) Downloaded 245 times
Adafruit_Unified_Sensor.rar
Librería
(12.75 KiB) Downloaded 240 times
EasyTransfer.rar
Librería
(95.15 KiB) Downloaded 223 times
PS2X_lib.rar
Librería
(9.41 KiB) Downloaded 233 times
45_08_05_2020.rar
Program
(16.46 KiB) Downloaded 231 times
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

ok so you got F() working, that's good. :D
but you were not short of memory anyway so it doesn't change anything much but will speed things up.

so next-
in slave, move ps2x.read_gamepad(); up to just under

void loop()
{
// put it here.

then move- ETout.sendData(); up to here-


txdata.HLraw = map(txdata.HLraw, -256, 256, 0, 179);
txdata.HRraw = map(txdata.HRraw, -256, 256, 0, 179);
//put it here.

and add delay(200); after it.

then move- ETin.receiveData(); down to...

//put it here
if (rxdata.BattVolt < LowBatVolts10)

and change it to-
if (ETin.receiveData();
{
delay (200);


and remove the "}" from here-
{//this one.
// A partir de aquí repito las ordenes de lcd, cambiándolas por Serial

Serial.print (F("\n Voltaje del ROV = "));
Serial.print (float(rxdata.BattVolt) / 10, 1);

then put-
else {return;}
near the end, here-

//put it here.
// #endif // des comentar cuando NO quiera imprimir los Serial.print


delay (200);



these changes will mean the code does not come to a stop if you do not receive data from the slave.

then see if it works.
if it doesn't, then disconnect the slave and see if the yellow led (your yellow led on pin 32, not the ps2 controller led) comes on when you press a button on the controller. The yellow led should come on if the controller is working whether or not anything else is working so you can concentrate on getting the controller working without worrying about the slave or connecting two laptops etc etc..
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenas noches.

Estoy haciendo los cambios que me ha dicho, y yo tengo que hacerle dos observaciones.

La primera, el código a modificar, no es el Esclavo, puesto que en el esclavo no están ninguna de las líneas que me dice de cambiar, están todas en el código Maestro.

Y la segunda, es que la ultima orden que usted me ha aconsejado, el programa no la admite, me da error de compilación, diciendo que no puede haber una orden "else", si no hay delante una orden "if".

then put-
else {return;}
near the end, here-

//put it here.
// #endif // des comentar cuando NO quiera imprimir los Serial.print


delay (200);
Un saludo.



Good night.

I'm making the changes you've told me, and I have to make two observations.

The first, the code to be modified, is not the Slave, since in the slave there are none of the lines that tells me to change, they are all in the Master code.

And the second, is that the last command that you have advised me, the program does not support it, gives me compilation error, saying that there can not be an "else" command, if there is no "if" command in front.

then put-
else {return;}
near the end, here-

//put it here.
// #endif // des comentar cuando NO quiera imprimir los Serial.print


delay (200);

Greetings.
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenas noches.

Le hago un comentario que igual nos sirve de ayuda.

En el Monitor Serie del Maestro, nada mas iniciarse el programa, me aparecen dos líneas seguidas y contradictorias.

La primera línea me dice " Controlador encontrado y configurado con éxito", que corresponde a las líneas de la configuración del mando, linea del programa 273 , e inmediatamente después me dice " Tipo de controlador desconocido", linea del programa 290

Por lo tanto no entiendo nada, si ha encontrado el controlador, porque no sabe que controlador es.

Un saludo.



Good night.

I'm making a comment that might help us.

In the Master Series Monitor, as soon as the program starts, I get two lines in a row and contradictory.

The first line tells me "Controller found and configured successfully", which corresponds to the lines of the command configuration, program line 273, and immediately after it tells me "Unknown controller type", program line 290

So I don't understand anything, if you have found the driver, because you don't know what controller it is.

Greetings.
Attachments
46_09_05_2020.rar
(16.49 KiB) Downloaded 233 times
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

haha... yes of course you are right, it was in master. :lol:

I have made some changes, mainly moving { and } around, it was easier than explaining where to move them to.

Try this and let me know if the yellow led comes on when you press a controller button.
I do not understand either.... why it does not recognise the controller type.
Attachments
01_Maestro_09_05_2020_Arreglando_Codigo_BBB.zip
(7.87 KiB) Downloaded 239 times
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenos días.

He realizado los cambios que usted me ha dicho, y el mando no hace nada, seguimos igual, "controlador encontrado", y "tipo de controlador desconocido", y no se enciende el led.

Incluso he cargado su programa, para ver como funciona, y por si yo me hubiera equivocado en algo, pero tampoco hace nada.

Un saludo.



Good morning.

I've made the changes that you've told me, and the controller doesn't do anything, we're still the same, "controller found", and "unknown controller type", and the LED doesn't turn on.

I've even loaded his program, to see how it works, and in case I've made a mistake on something, but it doesn't do anything either.

Greetings.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

ok.... try this...

in ps2x_lib.h (one of the library files)

// $$$$$$$$$$$$ DEBUG ENABLE SECTION $$$$$$$$$$$$$$$$
// to debug ps2 controller, uncomment these two lines to print out debug to uart

//#define PS2X_DEBUG
//#define PS2X_COM_DEBUG

so it reads-
#define PS2X_DEBUG
#define PS2X_COM_DEBUG

then save the file, re-compile the code and see what your master serial debug prints.
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenas noches.

He modificado la librería, como me ha dicho, y ahora en el Monitor Serie aparece esto.


Good night.
I modified the library, as you told me, and now this appears on the Serial Monitor.

Code: Select all


0 0:0 0:0 0:0 0:0 0:0 
0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:FF 0:FF 0:FF 0:FF 0:FF 0:FF 0:FF 0:FF 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN Configure
1:FF 43:79 0:5A 1:FF 0:FF 
OUT:IN Configure
1:FF 44:79 0:FF 1:FF 3:FF 0:FF 0:FF 0:FF 0:FF 
OUT:IN Configure
1:FF 4D:79 0:FF 0:FF 1:FF 
OUT:IN Configure
1:FF 4F:79 0:FF FF:FF FF:FF 3:FF 0:FF 0:FF 0:FF 
OUT:IN Configure
1:FF 43:79 0:5A 0:FF 5A:FF 5A:7B 5A:84 5A:84 5A:7B 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 

 Controlador encontrado y configurado con exito

 Tipo de controlador desconocido
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
 
 Temperatura Normal 
 Todo Despejado  !
 Voltaje del ROV = 5.0 
 Temperatura del casco = 24.00 *C  
 Temperatura motor DR = 24.00 *C1  
 Temperatura motor IZ = 24.00 *C2  
 Humedad en el interior del Casco = 59.00 %	 
 Humedad en el motor DR = 65.00 %	 
 Humedad en el motor IZ = 63.00 %	 
 Inclinación del eje X del ROV = 16448.00 
 Inclinación del eje Y del ROV = -136.00 
 Inclinación del eje Z del ROV = -1480.00 
 Temperatura del Giro MPU6050 = 25.09 
 Aceleración en el eje X del Giro MPU6050 = -260.00 
 Aceleración en el eje Y del Giro MPU6050 = 60.00 
 Aceleración en el eje Z del Giro MPU6050 = -102.00 
 Profundidad = 0.00 
 Direccion del ROV = 0.00 
 Temperatura sensor DS18B20 = 24.00 ºC 
 Valor del Sensor de Presión Interno =     Presión en Bar = 3.00    bars  || Presión en PSI = 47.00    psi 
 Valor del Sensor de Presión Externo =    Presión en Bar = 3.00    bars  || Presión en PSI = 45.00    psi
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
OUT:IN
1:FF 42:79 0:5A 0:FF 0:FF 0:7B 0:84 0:84 0:7B 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 
 
Temperatura normal


Después de la ultima secuencia de " 000 00 000" aparece, "Temperatura normal", y la lista de sensores con sus datos, luego vuelve a empezar, y cada vez que se ejecuta el código sale lo mismo, primero la lista de sensores con sus datos, y después, "OUT IN" "FF 42 79 etc.", otra vez.

After the last sequence of "000 00 000" appears, "Normal Temperature" appears, and the list of sensors with your data, then it starts again, and each time you run the code comes out the same thing, first the list of sensors with your data, and then, "OUT IN" " "FF 42 79 etc.", again.
Post Reply