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

confusing pin mode setup #1

Open
dneise opened this issue Jan 3, 2017 · 2 comments
Open

confusing pin mode setup #1

dneise opened this issue Jan 3, 2017 · 2 comments

Comments

@dneise
Copy link
Member

dneise commented Jan 3, 2017

There is no documentation about the pinout, i.e. which arduino pin is connected to what part of the motor controller board. So we have to deduce this from the code, which we know is working.

However, this code is confusing in parts, e.g.:

In the part, where the pin modes are setup as "INPUT" or "OUTPUT", this line
https://github.com/fact-project/ShutterController/blob/master/src/ShutterController.cpp#L261
implies the analog pins A0, A1, A2 and A3 are used as inputs.

For this project we need 2 analog inputs to measure each motors current consumptions and 2 analog inputs to measure each hall sensors position. So 4 inputs make total sense.


However here in function ReadCurrent() one can see, that in fact the analog inputs A4 and A5 are used to measure the motors current consumption. they are used, without ever being setup as inputs. The fact that this works is pure luck. Maybe the arduino std-lib sets them up as inputs, when one calls "analogRead()" on them, I don't know.

this is maximum confusing and must be changed.

@dneise
Copy link
Member Author

dneise commented Jan 3, 2017

I found A0 and A1 are never used at all, while being set up as inputs ...

@dneise
Copy link
Member Author

dneise commented Jan 3, 2017

A2 and A3 are used to measure the hall sensor values

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

1 participant