Graphing data received via Bluetooth from Arduino not graphing what I was expecting(?)

Ahh OK I'm following. I'm aware of Divide and Conquer and just couldn't figure a way of reducing this problem down. So the graph can be plotted as it is definitely receiving data via Bluetooth. But when trying to plot said data it does not. Struggling to figure out why.

I've had some time away from this project, I'll return soon but I forgot to bring the device on my trip so I'll have to wait a little longer then I had hoped.

Use:
("ISO-8859-1")

rather than

("UTF8")

...and how would that be useful?

because they are in UTF8 the ASCII range of 0..127.

Bigger than that bytes/characters are outside ASCII range, and UTF-8 is encoding them as two bytes, ie:

Unicode character 224 is encoded in UTF-8 as 195 160

1 Like

thank you so much. I followed this revised for my set up and graph run in real time.
But I dont understand well why Canvas1.height - global Y because I searched canvas coordinate system in MIT and compared. I am confused that step.

image

image
int in = A0;
Arduino code
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(in, INPUT);
}

void loop() {
//put your main code here, to run repeatedly:
float val = analogRead(in);
float val2 = val / 205*100;
Serial.println(val2);

delay(400);
}

The AI2 Canvas Y coordinate is reversed from people's usual expectations of the direction of Y.

In math class graphs, the origin (0,0) is in the lower left corner, with y extending upwards.

In the Canvas, the (0,0) origin is in the upper left, with Y extending downwards.

That's why to make a math class style graph, you need to flip the sign of the Y and pull it up to fit the height.

P.S. AI2 now has a graph component that can accept Bluetooth input directly.

P.P.S. I searched for why the origin is at the upper left for Canvases, and found:
canvas - Why are graphics coordinates measured from the upper left? - Stack Overflow.

Thank you so much. Based on your share, I thought and understood well about this problem. Respect !!!