I have a question, I have an arduino which, when connected, sends the text "Enter name". After connecting the arduino with an OTG cable in the "Serial USB monitor" application (from the play store), I normally see "enter name". In app inventor, I set it to connect in the application after pressing the "connect" button. But when plugging in the cable, I get the message "allow the application to null?" (or something like that - it's about usb) I confirm and I see illegible two stamps that were somehow sent by phone or more by an application and the name has been set to these two strange stamps (diamond with an icon)
and here is code from arduino (simple code- maybe someone will take - chat for arduino with NRF24L01 for 2 devices via USB serial):
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
const byte Address[5] = {'N','e','s','s','y'};
RF24 radio(CE_PIN, CSN_PIN);
String username = "";
String dataInput;
char dataToSend[32];
char dataReceived[32];
void setup() {
Serial.begin(115200);
Serial.println("Enter username...");
radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_1MBPS);
radio.setRetries(3, 5);
radio.openWritingPipe(Address);
radio.openReadingPipe(1, Address);
}
void loop() {
// set username
while (username == "") {
if ( Serial.available() ) {
username = Serial.readStringUntil('\n');
Serial.print("Welcome ");
Serial.println(username);
}
}
// listen for radio data
radio.startListening();
if ( radio.available() ) {
// read data from radio
radio.read( &dataReceived, sizeof(dataReceived) );
Serial.println(dataReceived);
}
if( Serial.available() ) {
// stop listening on radio
radio.stopListening();
// get serial input
dataInput = "[" + username + "] " + Serial.readStringUntil('\n');
Serial.println(dataInput);
dataInput.toCharArray(dataToSend, 32);
// send data
radio.write( &dataToSend, sizeof(dataToSend) );
}
}
What do I have to do so that the application does not send any information to the arduino when connecting and why is it happening at all?