Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Sample each axis and return the average as an integer
- function y = readAxis(ard, axisPin)
- reading = int32(0);
- sampleSize = int32(10);
- ard.analogRead(axisPin);
- for i = 0:1:sampleSize
- reading = reading + int32(ard.analogRead(axisPin));
- end
- y = reading/sampleSize;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement