spotopti.blogg.se

Kevin harlan streaker play by play
Kevin harlan streaker play by play







The device I bought was labelled “Keyes_SJoyes”.

kevin harlan streaker play by play

It consists of two potentiometers which give an analogue voltage based on the horizontal and vertical position of the thumb-stick. Pressing the stick activates a small switch. There are no fancy components on the board and because it is really just two variable resistors works fine with 3.3V despite the 5V PCB label. In order to measure the X and Y voltages I decided to use an MCP3008 10 bit Analogue to Digital Converter. These devices are cheap, easy to setup and allow 8 analogue inputs to be read by the Pi using it’s SPI interface. In this tutorial we will only need three of its inputs. See my previous MCP3008 post for details of how I used one to read light levels and temperature. The MCP3008 is wired up just as it was in my previous post : MCP3008 Pi Wire Colour VRy (Y voltage) MCP3008 Pin 3 (CH2) Green GND (Ground) Pi GPIO Pin 6 (Ground) Black Here is the wiring information for the joystick module : Joystick Pi/MCP3008 Wire Colour The pin-out of my joystick is slightly different to the Sparkfun symbol I used in this diagram but the wire colour coding matches the photos. In this case we are using three of the analogue inputs. You could read the Switch value using a normal GPIO pin but in this case I decided to use an analogue input for convenience. The 10K resistor is used to pull the switch input High (3.3V). When the switch is pressed the input is connected to ground (0V). Without the resistor the input would be in an undefined state when the switch wasn’t being pressed and read random values. Rather than repeat the instructions here open the Analogue Sensors On The Raspberry Pi Using An MCP3008 tutorial in a new browser window and complete the sections : In order to use the MCP3008 we need to configure the SPI bus on the Pi first. Hopefully if you’ve wired it up correctly and got the SPI interface configured we are ready to run a Python script to read the joystick values. The ADC is 10-bit so it can report a range of numbers from 0 to 1023 (2 to the power of 10). A reading of 0 means the input is 0V and a reading of 1023 means the input is 3.3V. In our circuit the switch will read 3.3V (1023) until it is pressed when it will read 0V (0). The X and Y joystick values will vary between as they are moved from one extreme to another. In the centre position we would expect a a value of 511.5.









Kevin harlan streaker play by play