Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
en:c1_tinkering [2015/12/02 16:19] brian.kim [Linux] |
en:c1_tinkering [2016/02/29 14:25] john1117 removed |
||
---|---|---|---|
Line 190: | Line 190: | ||
**Prerequisites**: You must have //python-dev// and //python-setuptools// installed If you manually rebuild the bindings with swig-python wiringpi.i | **Prerequisites**: You must have //python-dev// and //python-setuptools// installed If you manually rebuild the bindings with swig-python wiringpi.i | ||
- | 0. Get/setup WiringPi library (//If you already installed WiringPi library, skip this step.//) | ||
- | <code> | ||
- | # git clone https://github.com/hardkernel/wiringPi.git | ||
- | # cd wiringPi | ||
- | # sudo ./build | ||
- | </code> | ||
1. Get/setup WiringPi 2 for Python repository | 1. Get/setup WiringPi 2 for Python repository | ||
<code> | <code> | ||
# git clone https://github.com/hardkernel/WiringPi2-Python.git | # git clone https://github.com/hardkernel/WiringPi2-Python.git | ||
# cd WiringPi2-Python | # cd WiringPi2-Python | ||
+ | # git submodule init | ||
+ | # git submodule update | ||
</code> | </code> | ||
Line 230: | Line 226: | ||
# Set the LEDs | # Set the LEDs | ||
- | ledPos = adcValue / adc_unit | + | ledPos = (adcValue * len(leds) * 1000) / 1024 |
+ | ledPos = len(leds) - (ledPos / 1000) | ||
for x in leds: | for x in leds: | ||
wpi.digitalWrite(x, 0) | wpi.digitalWrite(x, 0) |