Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping random number issue #22

Open
chandanshiva opened this issue Dec 11, 2019 · 1 comment
Open

Mapping random number issue #22

chandanshiva opened this issue Dec 11, 2019 · 1 comment

Comments

@chandanshiva
Copy link

I'm learning Arduino by working on simple projects. I have an issue with the MPU6050 program with Arduino. I wanted to sweep servo based on the pitch and roll reading from the sensor, however, as the sensor auto-calibrates, if the sensor is not parallel to ground level it calibrates the value it gets as normal reading (i.e) if the sensor is parallel to ground, it should show 0 as reading which is normal value and then changes to negative or positive based on the rotation, if the sensor is inclined to ground level when its calibrating, say 10, it reads that value as normal and then increases or decreases based on the angle the sensor rotates. To sweep the servo from 0 to 180 deg, I need the least negative value and most positive value to be mapped from 0 - 180.

I tried to check the reading to map, sometimes the values will be all negative for example ranging from -10 to -100 sometimes completely positive eg: 10 - 150 sometimes both and negative like -50 to 50. the calibration gives random numbers, is there a way to map them with least number and highest number?

Any leads much appreciated, thank you.

@DrRadhika
Copy link

Same with me. I'am getting all the values in question marks. please help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants