So for a home security project, I am working on I am gonna be using a phone to be the "Main thingy). And in order to control certain things I need to connect them to an Arduino. In this case an Arduino Uno R3. The problem I am facing now is that I get this error:
int android.hardware.usb.UsbDeviceConnection.bulkTransfer(android.hardware.usb.UsbEndpoint, byte, int, int)
When trying to send data. My code looks like this at the moment. Anyone an idea what causes this? I am using an official Arduino cable with a Samsung OTG usb-c to usb female adapter. Sometimes it will ask to connect to null on my phone.
Actually, have another question. Hope you know that too ;). So I cant seem to actually read data from the Arduino. If I do it nothing happens. Never triggers the After Read
@dora_paz is is what I use atm. I saw it in a tutorial. My thoughts are it should read the println’s
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
pinMode(13, OUTPUT);
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
Serial.println("A!");
if(incomingByte == 65){
digitalWrite(13, HIGH);
}
}
}