I’m trying to get a basic app to work that receives data from a potentiometer and graphs the results. The app works in general but every so often (every 5 - 30 seconds) a digit is dropped and therefore my graph is not a smooth curve. I’m just beginning with app inventor so please help point me in the correct direction to solve the issues.
Here is my Arduino code:
int in = A0;
void setup() {
Serial.begin(9600);
pinMode(in,INPUT);
}
void loop() {
//Map the value from 10 bits to 8 bits:
byte val = map(analogRead(in),0,679.0,0,255); //map 3.3volts to 255 (1023*3.3/5)
Serial.print(val);
Serial.println("\n");
delay(5000); //Small delay between each data send
}
And here's my blocks
I tried to fix the the dropped digit by using a delimeter and the "\n" but that now does not read the data at all. It shows "Run Time Error The operation yail-divide cannot accept the arguments: , [ ], [255]"
So I think I have at least two errors in the current code shown. Thanks for any help.
Doug