7.- Testing version 2022-10-19.
p10A_OTG_Add.aia (190.4 KB)
https://github.com/rkl099/Appinventor_Debug
- Arduino UNO (CH340). Cable OTG. Cable USB.
-
Settings / Additional settings / OTG / Enable OTG.
-
Android 9. MIT Companion and installed.
- Arduino UNO (CH340)
String a;
String b;
int c;
int d;
void setup() {
Serial.begin(9600);
}
void loop() {
if(Serial.available()) {
a = Serial.readStringUntil(',');
b = Serial.readStringUntil('\n');
c = a.toInt() + b.toInt();
d = a.toInt() * b.toInt();
Serial.print(c);
Serial.print(",");
Serial.println(d);
}
}
- App sends two numbers separated by commas.
- Arduino receives them via Serial.
- Separate the two numbers.
- Add them and multiply them.
- Returns the addition and multiplication separated by commas.
- App receives the data, converts it into a list and displays it.