Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with INPUT pin mode #9

Open
LucasPa opened this issue Dec 19, 2013 · 2 comments
Open

Trouble with INPUT pin mode #9

LucasPa opened this issue Dec 19, 2013 · 2 comments

Comments

@LucasPa
Copy link

LucasPa commented Dec 19, 2013

Hi,

Before explaining the issue I have with your project, let me express how great I find it ! It is doing exactly what I need, thank you !

However I had some troubles when using a pin mode as "INPUT". For instance when running the following simple example :

from Arduino import Arduino

board = Arduino('9600') #plugged in via USB, serial com at rate 9600
board.pinMode(5,"INPUT")
board.close()

everything runs fine. However, if I run this same code a second time I get the following output :

File "./TestArduino.py", line 23, in
board = Arduino('9600') #plugged in via USB, serial com at rate 9600
File "/usr/local/lib/python2.6/dist-packages/arduino_python-0.2-py2.6.egg/Arduino/arduino.py", line 106, in init
raise ValueError("Could not find port.")
ValueError: Could not find port.

But then it works again if I disconnect and reconnect the Arduino. Such an issue is not happening if I replace "INPUT" by "OUTPUT". The versions of Python and python-serial are respectively 2.6.5 and 2.7.

The issue I have is then not a major obstacle since I can just reconnect the Arduino board. But I was thinking that you may want to give this a look.

Lucas

UPDATE :

This issue is not happening when running with Python 2.7 !

@thearn
Copy link
Owner

thearn commented Dec 21, 2013

Hi Lucas,
Glad you're enjoying the library!
Strange issue with rerunning codes in input mode. I'm out of town at the
moment, but I'll try and reproduce it & plan a fix when I get home. Thanks
for pointing it out!
-Tristan
On Dec 19, 2013 1:47 PM, "LucasPa" [email protected] wrote:

Hi,

Before explaining the issue I have with your project, let me express how
great I find it ! It is doing exactly what I need, thank you !

However I had some troubles when using a pin mode as "INPUT". For instance
when running the following simple example :

from Arduino import Arduino

board = Arduino('9600') #plugged in via USB, serial com at rate 9600
board.pinMode(5,"INPUT")
board.close()

everything runs fine. However, if I run this same code a second time I get
the following output :

File "./TestArduino.py", line 23, in
board = Arduino('9600') #plugged in via USB, serial com at rate 9600
File
"/usr/local/lib/python2.6/dist-packages/arduino_python-0.2-py2.6.egg/Arduino/arduino.py",
line 106, in init
raise ValueError("Could not find port.")
ValueError: Could not find port.

But then it works again if I disconnect and reconnect the Arduino. Such an
issue is not happening if I replace "INPUT" by "OUTPUT". The versions of
Python and python-serial are respectively 2.6.5 and 2.7.

The issue I have is then not a major obstacle since I can just reconnect
the Arduino board. But I was thinking that you may want to give this a look.

Lucas


Reply to this email directly or view it on GitHubhttps://github.com//issues/9
.

@tomateblue
Copy link

import Arduino
b = Arduino.Arduino("9600")
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/Arduino/arduino.py", line 106, in init
raise ValueError("Could not find port.")
ValueError: Could not find port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants