Skip to content

Commit 6a214f0

Browse files
committed
analog_read working
1 parent 2d80664 commit 6a214f0

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎pcduino/adc.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ def _get_path(id_):
1111
return os.path.join(_ADC_PREFIX, id_)
1212
raise InvalidChannelException
1313

14-
def analogRead(channel):
15-
with open(_ADC_PREFIX % channel, 'r') as f:
16-
return "%s" % f.read(32)
14+
def analog_read(channel):
15+
with open(_get_path(channel), 'r') as f:
16+
return int(f.read(32).split(':')[1].strip())

‎pcduino/gpio.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# io test code for pcDuino ( http://www.pcduino.com )
44
#
55
from exceptions import InvalidChannelException
6-
__all__ = ['HIGH', 'LOW', 'INPUT', 'OUTPUT','digitalWrite', 'digitalRead', "pinMode"]
6+
__all__ = ['HIGH', 'LOW', 'INPUT', 'OUTPUT','digital_write', 'digital_read',
7+
"pin_mode"]
78

89
_GPIO_PINS = set(('gpio%s' % i for i in xrange(20)))
910

‎pcduino/pwm.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
def digitalWrite(channel, value):
1+
def analog_write(channel, value):
22
pass

0 commit comments

Comments
 (0)