Python Documentation

6 years 1 month ago #29529148 by QuiXXotic
Replied by QuiXXotic on topic Python Documentation
Im using the wheezy from the NOOBS installation ive gotten from you in a previous discussion.
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.

6 years 1 month ago #29529168 by opal
Replied by opal on topic Python Documentation
Put the export line somewhere in "/etc/rc.local"

Please Log in or Create an account to join the conversation.

6 years 1 month ago #29529172 by QuiXXotic
Replied by QuiXXotic on topic Python Documentation
Yes thats what i have tried. My rc.local looks like this
#!/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.

6 years 1 month ago #29529177 by opal
Replied by opal on topic Python Documentation
You were right about "rc.local" - did not work for me either, sorry for the confusion.

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
Then:
pi@raspberrypi ~ $ pwd
/home/pi
And finally:
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
>>>
Let us know if same worked for you.

Please Log in or Create an account to join the conversation.

6 years 4 weeks ago #29529182 by QuiXXotic
Replied by QuiXXotic on topic Python Documentation
Yes this worked great! And ive managed to setup autologin and autostart of the .py script so now everything seems to be working so i can focus on the program itslef.

Thank you!

Please Log in or Create an account to join the conversation.

6 years 4 weeks ago #29529184 by opal
Replied by opal on topic Python Documentation
@QuiXXotic,
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.

5 years 10 months ago #29529477 by cweibel
Replied by cweibel on topic Python Documentation
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?

Please Log in or Create an account to join the conversation.

5 years 10 months ago #29529479 by QuiXXotic
Replied by QuiXXotic on topic Python Documentation

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?
The following user(s) said Thank You: cweibel

Please Log in or Create an account to join the conversation.

5 years 10 months ago - 5 years 10 months ago #29529481 by cweibel
Replied by cweibel on topic Python Documentation
I am having issues installing the RIO PC Config. Utility on Linux and Windows. Is there a supposed to be a physical link between the RIO-AHRS and the PC? Also, do I need to assign the i/o's functions? High and low is the same as on in off with digital logic I think.

Please Log in or Create an account to join the conversation.

5 years 10 months ago #29529482 by QuiXXotic
Replied by QuiXXotic on topic Python Documentation
Yes you need to connect the rioboard to the computer using the serialport. If you got the connector kit you got a 9-pole d-sub connector for this. You need to connect that to serialportpins on the rioboard i(llustration in manual). By default the inputpins work as analog/digital but if you want to use them as PWM out you need to change that in utility yes.

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.

Moderators: opal
Time to create page: 0.189 seconds