void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
int x1 = 1;
int y1 = 0;
int x2 = 37;
int y2 = 6;
float yd = ((float)y2 - (float)y1) / ((float)x2 - (float)x1);
// float yd = (y2 - y1) / (x2 - x1); // this does not work
Serial.print("yd: ");
Serial.print(yd, 4);
Serial.print("(y2 - y1): ");
Serial.print((y2 - y1));
Serial.print(", (x2 - x1): ");
Serial.print((x2 - x1));
Serial.print(", ((float)y2 - (float)y1) / ((float)x2 - (float)x1): ");
Serial.println(((float)y2 - (float)y1) / ((float)x2 - (float)x1), 5);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}