@zander Ron, if I have some code that defines the x_pin for a joystick as input, what would be the equivalent pin on a rotary encoder that would accomplish the same input?
Thanks
@banjobrad2 I just ordered some so have no experience, I would look at Bill's (DBWS) video/blog to see.
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
@banjobrad2 I think you mean output, a joystick has no electronic input, it translates human input to electronic output. I am unfamiliar with a joystick but can imagine it has a single terminal for X, an encoder is totally different. Maybe this article will help https://howtomechatronics.com/tutorials/arduino/rotary-encoder-works-use-arduino/
Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting
Hi @banjobrad2,
There is no 'universal' definition of the electrical interface of a joystick, but the most common is that of two potentiometers ... one in X direction and the other in the y direction. The circuit 'reading' each potentiometer position supplies a small voltage which is applied across the track of the pot, and the slider 'picks' off a fraction of the applied voltage, the voltage depending upon the position of the slider. Hence the input software will be measuring a voltage (from each pot).
The rotary converters are also provided with a small voltage, but the output consists of two possible voltage levels ... 0 and the applied voltage. Rotating the encoder knob causes the voltages levels to 'flip' and the resulting pulses can be converted into rotation signals.
These two interfaces are completely different and require differing software.
Best wishes,
Dave