map() outputs -1
hello everybody,
i working on program adjusts throttle value based off of accelerometer reading keep vehicle giving rider side accelerations. problem having when try map accelerometer values values 0-255 use adjusting throttle output of -1 .
this how setup command
i working on program adjusts throttle value based off of accelerometer reading keep vehicle giving rider side accelerations. problem having when try map accelerometer values values 0-255 use adjusting throttle output of -1 .
this how setup command
code: [select]
leftthrottleadjustment = map(ax, 0, 0.5, 0, 255);
the map function doesn't work float values, can multiply ax 10, 100 or 1000 give better range. likewise low , high ranges must changed too.
leftthrottleadjustment = map( int(ax*1000.0), 0, 500, 0, 255);
leftthrottleadjustment = map( int(ax*1000.0), 0, 500, 0, 255);
Arduino Forum > Using Arduino > Programming Questions > map() outputs -1
arduino
Comments
Post a Comment