- Forum
- RIO I/O Expansion Card and Navigation Computer
- Linux Installation & Programming
- Python Documentation
Python Documentation
cat /etc/*-release
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=raspbian
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Please Log in or Create an account to join the conversation.
- opal
Please Log in or Create an account to join the conversation.
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#export the pythonpath
export PYTHONPATH=$PYTHONPATH:/riofiles
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
exit 0
But it doesnt work. Ive read something about that since you arent logged in you have to give the entire location of the where to execute the comman. ie.:
/bin/bash ....
you cant just run
bash ....
Can it have something todo with that?
Gonna try to setup the autologin first and after that execute a script in .bashrc.
Please Log in or Create an account to join the conversation.
- opal
Here is what worked for me (thanks to your suggestion about .bashrc):
# in ~/.bashrc:
if [ -n ${PYTHONPATH+_} ] ;
then
export PYTHONPATH=/riofiles
else
export PYTHONPATH=/riofiles:$PYTHONPATH
fi
pi@raspberrypi ~ $ pwd
/home/pi
pi@raspberrypi ~ $ python
>>> import rioboard
>>> import sys
>>> for path in sys.path: print path
...
/riofiles
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/pymodules/python2.7
>>>
Please Log in or Create an account to join the conversation.
Thank you!
Please Log in or Create an account to join the conversation.
- opal
I am glad to know that it worked for you. We wish you quick and positive progress with your project!
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
cweibel wrote: I am trying to power the L298N motor driver and control it using the RIO-AHRS board. There are two input pins for each motor and an ENA pin. I need to send HIGH or LOW signals to the inputs and a PWM to the ENA. I have tried to do this with the test program, but it doesn't work. I have looked for the python documentation but there is nothing about the parameters of the test functions. Any suggestions?
Yo!
Well to start with have you assigned the i/o's to do what you want them to do using the RIO PC Configuration Utility? Havent worked much with the PWM outputs yet but i will but i got some understanding yes. The HIGH/LOW signals youre talking about is on and of or what?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
if you want to set a digital out using python it as simple as:
rioboard.SetDigitalOutput(X)
Where x is the number of the output 0-7 (8 outputs)
Please Log in or Create an account to join the conversation.
- Forum
- RIO I/O Expansion Card and Navigation Computer
- Linux Installation & Programming
- Python Documentation