I need help figuring out how to revieve an input on an app inventor app from an arduino via bluetooth. i already have outputs from appinventor to arduino but now need to reverse that for about 5 inputs to the app. the problem is whatever i seem to do the app or arduino is not translating the data correctly and will not read the input and there for will not show a picture that it is suppose to when a certain input is recieved. Please help. Very important project for work and almost done! Nedd help ASAP!
here is the arduino code.
int AUTO = 13;
int pp = 12;
int slider = 11; //pwm
int manUp = 10;
int manDown = 9;
int cal = 8;
int value = 52;
int testButton1 = 2;
int val1 = 49;
String readString;
void setup()
{
Serial.begin(9600);
pinMode(AUTO, OUTPUT);
pinMode(pp, OUTPUT);
pinMode(slider, OUTPUT);
pinMode(manUp, OUTPUT);
pinMode(manDown, OUTPUT);
pinMode(cal, OUTPUT);
pinMode(testButton1, INPUT);
analogWrite(slider, value); //default standoff = 1mm
value = -1;
}
void loop()
{
while (Serial.available())
{
delay(3);
value = Serial.read();
char c = Serial.read();
readString += c;
if (value >= 50)
{
Serial.println(value);
analogWrite(slider, value);
}
if (value == 33)
{
digitalWrite(AUTO, HIGH);
}
if (value == 34)
{
digitalWrite(AUTO, LOW);
}
if (value == 36)
{
digitalWrite(pp, HIGH);
}
if (value == 37)
{
digitalWrite(pp, LOW);
}
if (value == 38)
{
digitalWrite(manUp, HIGH);
}
if (value == 39)
{
digitalWrite(manUp, LOW);
}
if (value == 40)
{
digitalWrite(manDown, HIGH);
}
if (value == 41)
{
digitalWrite(manDown, LOW);
}
if (value == 35)
{
digitalWrite(cal, HIGH);
delay (200);
digitalWrite(cal, LOW);
}
}
val1 = digitalRead(testButton1);
if (val1 == HIGH)
{
Serial.println(val1);
delay(500);
}
}
Heres the app.