M Mostez Well-Known Member Licensed User Longtime User Oct 23, 2018 #1 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 Code: Copy /* 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); }
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 Code: Copy /* 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); }
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2018 #2 Yes. MapRange keyword. Upvote 0