Go to advanced search

by metachris
Mon Feb 11, 2013 7:23 pm
Forum: Automation, sensing and robotics
Topic: Need help with light and audio automation project
Replies: 2
Views: 682

Re: Need help with light and audio automation project

Yes, its all possible. 1. Control a light switch You'll want to use a transistor and a relay. 2. Switch my speaker system between either of two audio inputs (laptop or desktop) Most likely also with a transistor and a relay. 3. Link to my Android phone through an app, allowing me to control the Pi t...
by metachris
Mon Feb 11, 2013 6:28 pm
Forum: Automation, sensing and robotics
Topic: TUTORIAL: How to get a button working with the Pi!
Replies: 14
Views: 34047

Re: TUTORIAL: How to get a button working with the Pi!

import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN) while True: if GPIO.input(17): os.system("sudo shutdown -h now") prev_input = input time.sleep(0.05) After reading over it again I saw I missed the 'prev_input=...' line. Also I'd advise to add the pulldown...
by metachris
Sun Feb 10, 2013 9:22 pm
Forum: Automation, sensing and robotics
Topic: TUTORIAL: How to get a button working with the Pi!
Replies: 14
Views: 34047

Re: TUTORIAL: How to get a button working with the Pi!

Here's mine... import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.IN) prev_input = 0 while True: input = GPIO.input(17) if ((not prev_input) and input): os.system("sudo shutdown -h now") prev_input = input time.sleep(0.05) Uses basically no appreciable CPU, and...
by metachris
Sun Feb 10, 2013 9:16 pm
Forum: Deutsch
Topic: Softwareverteilung im Netzwerk
Replies: 3
Views: 1136

Re: Softwareverteilung im Netzwerk

Schau dir mal Fabric an; ist genau für sowas gemacht. Damit kannst du zB. auf allen Geräten auf einmal Kommandos oder Skripte ausführen, sowie noch vieles mehr.
by metachris
Sun Feb 10, 2013 8:20 pm
Forum: Python
Topic: Using event to synchonize threads
Replies: 2
Views: 543

Re: Using event to synchonize threads

You don't need all this '.wait()' and '.clear()' code since both threads run simultaneously by default. Just do it like this: from time import sleep from threading import Thread def do_stuff_in_a_thread(foo, bar): print "Thread: starts doing stuff" sleep(5) print "Thread: quitting now" def main(): t...
by metachris
Sun Feb 10, 2013 8:09 pm
Forum: Python
Topic: python
Replies: 8
Views: 1109

Re: python

by metachris
Sun Feb 10, 2013 8:06 pm
Forum: Python
Topic: why does python-pip require an older version of python?
Replies: 5
Views: 30459

Re: why does python-pip require an older version of python?

You can also install pip with python-setuptools (which includes the 'easy_install' command): sudo apt-get install python-setuptools sudo easy_install pip Sidenote: If you are running Python 3 or multiple Python versions at the same time, use the specific easy_install (eg. 'easy_install3.2' or 'easy_...
by metachris
Fri Feb 08, 2013 4:35 pm
Forum: Debian
Topic: Debian Image
Replies: 8
Views: 2145

Re: Debian Image

Cloudcentric wrote:Windows will only recognise the boot partition on the card, it doesn't recognise Linux EXT file systems.
FTFY
by metachris
Fri Feb 08, 2013 2:41 pm
Forum: Raspbian
Topic: Finding new planets using the Pi
Replies: 6
Views: 845

Re: Finding new planets using the Pi

Just a word of precaution - it will be very, very slow on the Raspberry due to it's low SD speed (~4MB/s). Like an order of magnitude slower than on any PC with an IDE/SATA HD.
by metachris
Fri Feb 08, 2013 2:32 pm
Forum: Python
Topic: Check for input from phone?
Replies: 7
Views: 1068

Re: Check for input from phone?

First of all, SMTPLIB is for sending emails only. There are other modules to read emails (eg. poplib ). To send a value from the phone to the Pi you'll need some sort of connection between the two devices. Some suggestions: * Have a webserver running on the Pi and access it with the phone's browser ...
by metachris
Fri Feb 08, 2013 2:17 pm
Forum: Python
Topic: Finding Info on libraries
Replies: 3
Views: 856

Re: Finding Info on libraries

The Python command 'help(...)' shows the same info as 'pydoc'. If you don't find enough information in there its most likely a badly documented module and you'll need to take a look at the source. Both the help/pydoc commands show you the filename of the module at the very top. Edit: Found the git r...
by metachris
Thu Feb 07, 2013 8:20 pm
Forum: Beginners
Topic: Log in as root - debian
Replies: 4
Views: 11843

Re: Log in as root - debian

You could re-enable logging in as user 'pi' by plugging the SD card into a cardreader on a computer, mount the root partition in a Linux OS (virtual machine works just fine), and remove the comment you added in /etc/passwd.
by metachris
Thu Feb 07, 2013 2:22 pm
Forum: General discussion
Topic: Raspberry Pi Revision identification
Replies: 14
Views: 37611

Re: Raspberry Pi Revision identification

I just wrote up a little Python script to display model and maker, and thought I'd share it here: https://github.com/metachris/raspberryp ... etector.py
by metachris
Thu Feb 07, 2013 11:43 am
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Have I destroyed my GPIO pins?
Replies: 3
Views: 1194

Re: Have I destroyed my GPIO pins?

I suggest two small changes your code (add the pulldown resistor via RPi.GPIO, and just show changed values): from time import sleep import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BCM) GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) input_last_value = None while True: input_value...
by metachris
Wed Feb 06, 2013 11:14 pm
Forum: Other programming languages
Topic: Assign Bash array elements into unique predictiable variable
Replies: 4
Views: 1249

Re: Assign Bash array elements into unique predictiable vari

I would strongly suggest you switch to Python as programming language once you start dealing with arrays, because the bash syntax can get quite non-intuitive. With that being said, here is a solution that does what you want: for index in ${!modulelist[*]}; do export "VARIABLE${index}"=${modulelist[$...
by metachris
Wed Feb 06, 2013 4:16 pm
Forum: Python
Topic: wont start on boot /ett/init.d
Replies: 3
Views: 892

Re: wont start on boot /ett/init.d

Best practice for starting custom scripts at boot is by using rc.local (instead of cron). The file '/etc/rc.local' contains one command per line that is executed when booting has finished. Just add your command to it and be done :)
by metachris
Wed Feb 06, 2013 2:57 pm
Forum: Python
Topic: Python IDE
Replies: 9
Views: 8108

Re: Python IDE

Here are two Python IDE overviews: http://wiki.python.org/moin/IntegratedDevelopmentEnvironments http://stackoverflow.com/questions/81584/what-ide-to-use-for-python I personally can strongly recommend PyCharm . Although it costs a bit of money I found it to save me so much time to easily be worth it...
by metachris
Wed Feb 06, 2013 2:49 pm
Forum: Python
Topic: Rapi hangs
Replies: 8
Views: 1391

Re: Rapi hangs

Read this: http://docs.python.org/2/library/stdtyp ... file.flush

TLDR: Use file.flush() followed by os.fsync() to ensure all data is written to the disk of a still opened file.
by metachris
Wed Feb 06, 2013 2:26 pm
Forum: Python
Topic: python module installation help
Replies: 4
Views: 15899

Re: python module installation help

You should get pip , a standard command line tool to install packages form the Python Package Index. Using pip you would just run ' pip install crcmod '. Take a look at the pip installation documentation [/u]. There are two quick ways to get pip (you'll need to be logged in as root to install stuff ...
by metachris
Wed Feb 06, 2013 2:14 pm
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6184

Re: Interrupts

I think you might have more luck with a simpler Python module, as WiringPi does a lot of things and is quite complex. I've just written a really slim module to handle interrupts with epoll for my own needs: https://github.com/metachris/raspberrypi-gpio-utils . There is also an extremely simple examp...
by metachris
Wed Feb 06, 2013 1:56 pm
Forum: Deutsch
Topic: USB Power
Replies: 2
Views: 1035

Re: USB Power

Das ist kein Problem, da nur das Netzteil und der USB Hub mit den 2A klarkommen muessen; was sie laut Angaben tun. Der Raspberry selbst zieht ja nur max 700mA, also kann der USB Hub noch 1.3A an die anderen Geräte verteilen. Wenn dir das zu wenig werden sollte kannst du immer noch den Raspberry an e...

Go to advanced search