Why the inventor does not work with the Arduino by connecting to the uart port ,,Note that there is a connection on the Serial USB Terminal application ???

//variable for Serial input
int input = 0;
//Pins for LED
const int LED = 13;

// the setup function runs once
void setup() {
  //Start the serial monitor at 9600 baud
  Serial.begin(9600);
  //Declare the LEDs to be outputs
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
}

//runs over and over again
void loop() {
  //check if there's incoming data,
  if (Serial.available() > 0) {
    //if so, then read the incoming data.
    input = Serial.read();

    //if data, send the pin high
    if (input == '1') {
      digitalWrite(LED, HIGH);
      //send back data to phone
      Serial.println("4");
    }
    else if (input == '0') {
      digitalWrite(LED, LOW);
      Serial.println("5");
    }
  }

Hello Ossaa, welcome to the forum.

Why are you ignoring the result of the OpenSerial call? Your code should only continue if OpenSerial = True.

I'm not sure about the required hardware - are you using Rolf Kardell's extension?

Serial component works with original Arduino UNO, but it doesn't work with many clones, for example those with CH340/CH341 chip.
It has also worked for me with the CP2102 module.

For other devices, use the extension that Chris has recommended, here are several examples:
https://community.appinventor.mit.edu/t/serial-otg-arduino-ch340-ftdi-rkl099s-extension/21156

1 Like