B4R Question map function

Mostez

Well-Known Member
Licensed User
Longtime User
Hello,
I want to use Arduino 'map' function to scale battery voltage like code in this example, is there any similar B4R code? function details here.

Thanks

B4X:
/* Map an analog value to 8 bits (0 to 255) */
void setup() {}

void loop()
{
  int val = analogRead(0);
  val = map(val, 0, 1023, 0, 255);
  analogWrite(9, val);
}
 
Top