Esta función no es reconocida por mi Arduino Mega 2560 R3, he probado de utilizar varias placas con él
pero ninguna ha dado resultado.
Tengo que copiar algún sketch que usa esta función y de momento estoy "clavado".
¿Pueden ayudarme ha "desclavarme" ?:
muchas gracias
Pie_de_Rey
Post your code.
............. mi código es el siguiente:
si (W.indexOf ("P13")> 0)
{digitalWrite (13,! digitalRead (13));
Serial.println ("Invirtiendo pin 13");
}
Leyenda del error:
estado de salida 1
Arduino: 1.8.13 (Windows 10), Tarjeta: "Arduino Mega o Mega 2560, ATmega2560 (Mega 2560)"
estado de salida 1
'class String' no tiene ningún miembro llamado 'indexOF'; ¿quisiste decir 'indexOF'?
¡Sorprendente!
Pero ahora viene lo mejor: ¡¡Sí indexOF se copia con "copiar y pegar" desde una wed si funciona !!
Por tanto estoy utilizando dicho método. Pero esto no es la solución.
¿Puede ayudarme a encontrarla ?.
Pie_de_Rey
Please post all your code. To help, we need to be able to compile it - a little snippet is not much use.
. . . . . . . este es el esquema completo:
#include <SoftwareSerial.h>
SoftwareSerial Soft (3, 2);
Cadena W = "";
char w;
configuración vacía () {
Serial.begin (9600);
Soft.begin (9600);
pinMode (13, SALIDA);
}
bucle vacío () {
if (Soft.available ()) {
w = Soft.read ();
Serial.print (w);
W = W + w;
}
if (Serial.available ()) {
char s = Serial.read ();
Soft.print (s);
}
si (w == char (13))
{if (W.indexOF ("P13")> 0)
{digitalWrite (13,! digitalRead (13));
Serial.println("Invirtiendo pin 13");
}
W = ""; w = '';
}
Ahora sí elimino indexOF y lo sustituyo por otro indexOF desde otro código valido a través de "copiar y pegar" entonces
si funciona!!
I am not familiar with what you are doing. It looks as though you're coding in Spanish. Usually when that happens, variable names can be in the user's native language but keywords like if and else are not.
There have been variants of COBOL I think that were available in French and German, but I have never seen it done in C. If somehow you have translation enabled, perhaps you need to find the Spanish equivalent of indexOf.
Querido amigo, buenos días.
La conclusión que he llegado es que indexOF() no funciona en la versión Arduino 1.8.13..
La única solución que tengo a mano es a través de "copiar y pegar" desde la Wed.
Disculpa las molestias que haya podido ocasionarte.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.