You are not reading voltages, you are reading the value returned from the ADC. The MCP3008 is a 10-bit ADC so the values it can return are between 0000000000 and 1111111111 or in decimal 0 to 1023 for 0V and 5V respectively. However, in the middle position, and assuming you are not connecting any resistors to the switch outputs it should produce half the supply to the Joystick (2.5V) which would read as 512 from the ADC.I don't know why I'm not seeing 0 2.5 and 5.0v.
Hi,
You talk about wiring, but don't show a schematic. How can we know what you are doing?
Klaus
You are not reading voltages, you are reading the value returned from the ADC. The MCP3008 is a 10-bit ADC so the values it can return are between 0000000000 and 1111111111 or in decimal 0 to 1023 for 0V and 5V respectively. However, in the middle position, and assuming you are not connecting any resistors to the switch outputs it should produce half the supply to the Joystick (2.5V) which would read as 512 from the ADC.
You should have it wired:
1 - X analog voltage to the ADC
2 - Y analog voltage to the ADC
3 - 5V
4 & 5 - only used if you are using its rotary function, in which case they feed a quadrature decoder
6 & 7 - the 'push' switch, they are isolated from other pins so use it digital input with a pull-up or pull-down resistor.
8 - 0V (GND)
Brian.
Yes, but it is possible no such device is made. The rotary encoder is a plastic disc with slots in it. Either one LED shines through it on to two sensors or two LEDs independently shine through it on to sensors. The LEDs/sensors are positioned so one gets illuminated before the other, by looking at the output of the sensors it is therefore possible to see which direction it was turned and by how much. The LEDs may need several volts (although usually around 1.8V) to light them sufficiently for the sensor to see enough light.I guess if it had been a 3.3v device, all of these modifications would not have been necessary.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?