Go to advanced search

by metachris
Thu Feb 28, 2013 1:11 am
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19109

Re: RPIO: An extension of RPi.GPIO with interrupt management

Thank you; comments like these are always motivating :) I've just put RPIO 0.8.3 on pypi which includes TCP socket interrupts, because they just go along so well with epoll. For now RPIO just sends the strings from the TCP clients to the callback, but i'll be adding more features in the near future....
by metachris
Thu Feb 28, 2013 12:56 am
Forum: Python
Topic: PWM
Replies: 15
Views: 2820

Re: PWM

Is your script and pizypwm.py is in the same folder?
by metachris
Wed Feb 27, 2013 9:04 pm
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6148

Re: Interrupts

Blocking (eg. with sleep()) is not necessarily bad; it just blocks everything else in the same thread. A callback inside an extra thread can do whatever it wants while RPIO can return to waiting for interrupts.
by metachris
Wed Feb 27, 2013 2:48 pm
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6148

Re: Interrupts

Not a stupid question at all. If you set the threaded_callback parameter to True, your callback will be started inside a Thread . Thread is the keyword you are looking for. Each program has one main thread, and all other threads run concurrently, with the operating system scheduling the timeslots fo...
by metachris
Wed Feb 27, 2013 9:40 am
Forum: Python
Topic: PWM
Replies: 15
Views: 2820

Re: PWM

You can also use https://github.com/metachris/raspberrypi-pwm (based on the excellent servod.c by Richard Hirst). This uses DMA to get very accurate PWM signals on 8 channels. To customize it you'll want to change a few variables in the c file, most likely the GPIO numbers. I'm working on implementi...
by metachris
Wed Feb 27, 2013 2:18 am
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6148

Re: Interrupts

It was just too straight-forward not to do it... RPIO now supports TCP socket interrupts ! :) It's very easy; one new command: RPIO.add_tcp_callback(port, callback[, threaded_callback=False]) You can find a full example and more information at http://pythonhosted.org/RPIO/#ref-rpio-py-tcpserver . I'...
by metachris
Tue Feb 26, 2013 4:46 pm
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6148

Re: Interrupts

Yes this is correct - you can't wait for socket packets with RPIO. But you can use epoll at many places concurrently; for instance you could run "RPIO.wait_for_interrupts()" in a Thread and wait for the socket packets with another epoll call. Or extend RPIO.py with generic socket support; should be ...
by metachris
Mon Feb 25, 2013 10:55 am
Forum: Python
Topic: Python wiringPI - Read 433 Mhz Data
Replies: 6
Views: 5596

Re: Python wiringPI - Read 433 Mhz Data

Small correction to the code above: instead of "if value:" you should use "if value == "1":" Even with 10kbps I'm not quite certain you can get this resolution with interrupts (or Python); the print() statement will definitely delay things quite a bit if it is called a few thousand times a second.
by metachris
Mon Feb 25, 2013 10:20 am
Forum: Python
Topic: Python wiringPI - Read 433 Mhz Data
Replies: 6
Views: 5596

Re: Python wiringPI - Read 433 Mhz Data

You can try using RPIO and interrupts to measure the period time with something like this: import time import RPIO class MeasurePeriod(object): self.time_last = None def measure_period(self, gpio_id, value): t = time.time() if value: self.time_last = t elif self.time_last: print("State 1 lasted for ...
by metachris
Sun Feb 24, 2013 8:15 pm
Forum: Python
Topic: object has no attribute 'setmode'
Replies: 9
Views: 9624

Re: object has no attribute 'setmode'

Perhaps you were using an old version of RPi.GPIO. You can update it with `sudo easy_install -U RPi.GPIO`, and print the version with `import RPi.GPIO; print RPi.GPIO.VERSION`.
by metachris
Sun Feb 24, 2013 11:49 am
Forum: Troubleshooting
Topic: Wifi Can't Connect Using Headless Pi
Replies: 3
Views: 557

Re: Wifi Can't Connect Using Headless Pi

iwconfig shows: wlan0 IEEE 802.11bgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry long limit:7 RTS thr:off Fragment thr:off Encryption key:off Power Management:on If you are using your Pi headless, make sure to turn wifi power management off. Else the Pi might becom...
by metachris
Sun Feb 24, 2013 11:24 am
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6148

Re: Interrupts

I'm glad RPIO works well for what you want to do! And yeah, there are more features coming -- the module is under very active development and I'm open to suggestions and feature ideas. What I've just finished is software pullup and -down resistors for interrupts (part of the next update) and am taki...
by metachris
Sat Feb 23, 2013 11:35 pm
Forum: Python
Topic: RPi.GPIO usage
Replies: 4
Views: 1215

Re: RPi.GPIO usage

Ups, I forgot about the new initial parameter! Thanks for clearing that up.
by metachris
Sat Feb 23, 2013 7:01 pm
Forum: Python
Topic: RPi.GPIO usage
Replies: 4
Views: 1215

Re: RPi.GPIO usage

RPi.GPIO does not allow to set the output of a gpio before calling setup(...) on it first [1]. (you can do it with my RPIO module with RPIO.forceoutput(...).) With RPi.GPIO the easiest solution would be to call GPIO.output(...) right after GPIO.setup(...).
by metachris
Sat Feb 23, 2013 4:08 pm
Forum: Python
Topic: Interrupts
Replies: 24
Views: 6148

Re: Interrupts

Have you tried it with RPIO, my extension of RPi.GPIO with interrupt handling? (its now at https://github.com/metachris/RPIO ), and the previous link won't work anymore.) In my tests with RPIO I can wait for interrupts on any number of GPIOs and they work independently. All the necessary code is thi...
by metachris
Fri Feb 22, 2013 7:58 pm
Forum: Python
Topic: RPi.GPIO Documentation
Replies: 4
Views: 15068

Re: RPi.GPIO Documentation

You can find all the RPi.GPIO functions in the C source code of RPi.GPIO . Starting at line #489 you can see all the exported methods: setup(...) cleanup(...) output(...) input(...) setmode(...) set_rising_event(...) set_falling_event(...) set_high_event(...) set_low_event(...) event_detected(...) g...
by metachris
Fri Feb 22, 2013 11:31 am
Forum: Troubleshooting
Topic: Keyboard not working
Replies: 2
Views: 406

Re: Keyboard not working

What kind of keyboard is it (USB, Wireless)? Can you try it with another keyboard to make sure it's the keyboards fault? Also make sure to have it plugged in before you power up the RPi (I've had issues plugging some wireless keyboards USB plug into a running Pi).
by metachris
Fri Feb 22, 2013 10:47 am
Forum: Python
Topic: RPIO Update: Inspect and Manipulate GPIOs System-Wide
Replies: 0
Views: 692

RPIO Update: Inspect and Manipulate GPIOs System-Wide

I've just updated RPIO on PyPI , and would love to receive some feedback! Besides RPIO.py the update includes a new command-line multitool " rpio " which allows you to inspect and manipulate GPIOs system wide, including those used by other processes. You can find a beautiful version of the documenta...
by metachris
Tue Feb 19, 2013 2:59 pm
Forum: Python
Topic: dht22 sensor with python
Replies: 1
Views: 2377

Re: dht22 sensor with python

The interesting part of the error message is this:
bcm2835_init: Unable to open /dev/mem: Permission denied
This tells us you don't have enough privileges to access /dev/mem. You can run the command as superuser:

Code: Select all

sudo python Adafruit_DHT_googledocs.ex.py
by metachris
Tue Feb 19, 2013 1:11 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19109

Re: RPIO: An extension of RPi.GPIO with interrupt management

I believe Ben Croston was/is working on interrupts (amongst other things). Are you in touch with him? Can it be used alongside RPi.GPIO in the same script? Or does it have to be used by itself? Ben Croston and I are communicating, but RPi.GPIO does not have a real interrupt solution, just some poll...
by metachris
Tue Feb 19, 2013 12:43 am
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19109

RPIO: An extension of RPi.GPIO with interrupts, PWM and more

Hey everyone! I wanted to let you know about RPIO , an extension of RPi.GPIO with interrupt handling, which I've just uploaded to pypi. This is an example which handles events on 3 gpio pins, each with different edge detection: import RPIO def do_something(gpio_id, value): print("New value for GPIO ...
by metachris
Mon Feb 18, 2013 11:55 pm
Forum: Python
Topic: Using variables across functions
Replies: 4
Views: 685

Re: Using variables across functions

You have two options: either use globals or objects. With globals you always have to declare it as such before setting a variable: var1 = "" def funtion1(): global var1 var1 = "a" def funtion2(): print var1 funtion1() funtion2() A better choice would be to use objects: class MyClass(object): var1 = ...
by metachris
Sun Feb 17, 2013 4:20 pm
Forum: General discussion
Topic: Raspberry Pi Revision identification
Replies: 14
Views: 37590

Re: Raspberry Pi Revision identification

Anyone knows who manufactured '0002' and '0003'? Perhaps we could also collect more infos about differences in the gpio numbering scheme, etc.

In case anyone is interested - I've updated the rpi_detect_model.py script to make the specific attributes more easily accessible.
by metachris
Fri Feb 15, 2013 11:28 am
Forum: Python
Topic: General inter-process communication in python
Replies: 7
Views: 6847

Re: General inter-process communication in python

I've written a simple gpio-daemon which runs in the background and can receive commands from any other process via unix sockets. Take a look - perhaps it could relate to what you want to do: https://github.com/metachris/raspberrypi-utils

Go to advanced search