Map Funktion mit Dezimalzahlen

Erst mappen, dann teilen:

void setup() {
  Serial.begin(19200);
}

void loop() {
  int winkelAnalog = analogRead(A0);
  float winkelWert;

  winkelWert = map(winkelAnalog, 0, 630, 0, 900) / 10.0;

  Serial.println(winkelWert, 1);

  delay(200);
}

EDIT: 90 durch 900 ersetzt.

1 Like