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
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);


Arduino Forum > Using Arduino > Programming Questions > map() outputs -1


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support