-
Notifications
You must be signed in to change notification settings - Fork 0
current sensor #7
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
base: main
Are you sure you want to change the base?
Conversation
float current = raw / SENS_SCALE; | ||
|
||
return current; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd set the resolution back to 10 here. That way, this function has no side effects, and you don't need to keep track of the order of read() calls or wonder what the resolution is for any given function in a year or two when you come back to this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Set back" in which meaning:
At the end of the function call analogReadResultion(10);
Or just never change it at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset it at the end of the function. Idk enough about the sensor or the Teensy to know if it needs to be changed in the first place, but if it does, either confirm that you can use 12 bits everywhere (and only change it once in setup()
, or err on the side of caution and reset it back to 10 at the end of this function
Reads current from HAS-50 current sensor (blue thing with hole in middle) with an accuracy of around +-50 mA.