try to run the test examples for the HAT I recently bought, but they do not run.
I am getting IOError: Errno 2 no such file or directory
I did everything in the setup procedure correctly.
Please help me.
Adafruit Motor HAT for pi test examples
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit Motor HAT for pi test examples
Please post the entire error message. It may be several lines long. Which python example are you running ?
- gurmar
- Posts: 3
- Joined: Mon Feb 23, 2015 5:09 pm
Re: Adafruit Motor HAT for pi test examples
the screen is:
pi@raspberrypi ~/Adafruit-Motor-HAT-Python-Library/examples $ sudo python StepperTest.py
Traceback (most recent call last):
File "StepperTest.py", line 3, in <module>
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/__init__.py", line 1, in <module>
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_MotorHAT.py", line 3, in <module>
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 11, in <module>
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 35, in PWM
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_I2C.py", line 43, in __init__
IOError: [Errno 2] No such file or directory
pi@raspberrypi ~/Adafruit-Motor-HAT-Python-Library/examples $ sudo python StepperTest.py
Traceback (most recent call last):
File "StepperTest.py", line 3, in <module>
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor, Adafruit_StepperMotor
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/__init__.py", line 1, in <module>
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_MotorHAT.py", line 3, in <module>
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 11, in <module>
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 35, in PWM
File "build/bdist.linux-armv6l/egg/Adafruit_MotorHAT/Adafruit_I2C.py", line 43, in __init__
IOError: [Errno 2] No such file or directory
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit Motor HAT for pi test examples
It looks like you haven't configured I2C on your Pi.
https://learn.adafruit.com/adafruits-ra ... guring-i2c
https://learn.adafruit.com/adafruits-ra ... guring-i2c
- gurmar
- Posts: 3
- Joined: Mon Feb 23, 2015 5:09 pm
Re: Adafruit Motor HAT for pi test examples
thanks a lot. finally I managed it work with your help.
- jhroelofs
- Posts: 5
- Joined: Wed May 06, 2015 12:00 pm
Re: Adafruit Motor HAT for pi test examples
I'm having a similar problem- set up everything, I felt like I instalelled I2C and python properly, but I keep getting this error message:
pi@raspberrypi ~/Adafruit-Motor-HAT-Python-Library/examples $ sudo python DCTest.py
Traceback (most recent call last):
File "DCTest.py", line 2, in <module>
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/__init__.py", line 1, in <module>
from .Adafruit_MotorHAT import Adafruit_StepperMotor, Adafruit_DCMotor, Adafruit_MotorHAT
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_MotorHAT.py", line 3, in <module>
from Adafruit_PWM_Servo_Driver import PWM
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 11, in <module>
class PWM :
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 35, in PWM
general_call_i2c = Adafruit_I2C(0x00)
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_I2C.py", line 43, in __init__
self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
Any ideas?
Thanks!
pi@raspberrypi ~/Adafruit-Motor-HAT-Python-Library/examples $ sudo python DCTest.py
Traceback (most recent call last):
File "DCTest.py", line 2, in <module>
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/__init__.py", line 1, in <module>
from .Adafruit_MotorHAT import Adafruit_StepperMotor, Adafruit_DCMotor, Adafruit_MotorHAT
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_MotorHAT.py", line 3, in <module>
from Adafruit_PWM_Servo_Driver import PWM
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 11, in <module>
class PWM :
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_PWM_Servo_Driver.py", line 35, in PWM
general_call_i2c = Adafruit_I2C(0x00)
File "/usr/local/lib/python2.7/dist-packages/Adafruit_MotorHAT-1.2.0-py2.7.egg/Adafruit_MotorHAT/Adafruit_I2C.py", line 43, in __init__
self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
Any ideas?
Thanks!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit Motor HAT for pi test examples
What do you get from the command i2cdetect -y 1
- jhroelofs
- Posts: 5
- Joined: Wed May 06, 2015 12:00 pm
Re: Adafruit Motor HAT for pi test examples
I had to run it as root, and got the following:
pi@raspberrypi ~ $ i2cdetect -y 1
Error: Could not open file `/dev/i2c-1': Permission denied
Run as root?
pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
pi@raspberrypi ~ $ i2cdetect -y 1
Error: Could not open file `/dev/i2c-1': Permission denied
Run as root?
pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
- jhroelofs
- Posts: 5
- Joined: Wed May 06, 2015 12:00 pm
Re: Adafruit Motor HAT for pi test examples
Also, when I try to run the example DCTest.py, I get
Error accessing 0x61: Check your I2C address
Repeating over and over until I shut the pi down
Error accessing 0x61: Check your I2C address
Repeating over and over until I shut the pi down
- jhroelofs
- Posts: 5
- Joined: Wed May 06, 2015 12:00 pm
Re: Adafruit Motor HAT for pi test examples
I changed the "addr=0x61" in the DCTest.py script to a 60 and it worked! Not sure exactly what happened but we're good to go!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
- bdog253
- Posts: 2
- Joined: Tue Jun 30, 2015 10:29 pm
Re: Adafruit Motor HAT for pi test examples
Hey guys,
I was having the same issues with the addressing and fixed it by changing it to use 0x60. The issue I'm running into now is that when I run the script the first time it starts the motor but then reboots the pi. Once rebooted if I run the script again it seems to work okay. When I hit ctrl-C to get out of the loop and then try and run again it then reboots.
Did I screw up my hat while soldering? Is there a quick way to test if the hat is still okay?
Thanks in advance.
*** EDIT ***
Upon further investigation it would seem when running the code the first time it just starts the motor at half speed and then reboots. When I commented out the line of code that says myMotors.setSpeed(150) everything seemed to work okay and it no longer reboots.
I was having the same issues with the addressing and fixed it by changing it to use 0x60. The issue I'm running into now is that when I run the script the first time it starts the motor but then reboots the pi. Once rebooted if I run the script again it seems to work okay. When I hit ctrl-C to get out of the loop and then try and run again it then reboots.
Did I screw up my hat while soldering? Is there a quick way to test if the hat is still okay?
Thanks in advance.
*** EDIT ***
Upon further investigation it would seem when running the code the first time it just starts the motor at half speed and then reboots. When I commented out the line of code that says myMotors.setSpeed(150) everything seemed to work okay and it no longer reboots.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Adafruit Motor HAT for pi test examples
So you're good to go?
- bdog253
- Posts: 2
- Joined: Tue Jun 30, 2015 10:29 pm
Re: Adafruit Motor HAT for pi test examples
Yes thanks. Everything seems to be working as long as I don't have that line of code. Not sure why. I've written a bunch of other scripts to test out 3 motors and everything seems okay. Thanks again!
- JTibbetts
- Posts: 3
- Joined: Wed Nov 18, 2015 8:10 am
Re: Adafruit Motor HAT for pi test examples
Hi, we are also getting similar issues (by this i mean it won't power the motor and get error messages out the yingyang) but, changing it to 60 did nothing.
Please help.
Please help.
Please be positive and constructive with your questions and comments.