Go to advanced search

by michaelperakis
Fri Aug 08, 2014 9:10 pm
Forum: Automation, sensing and robotics
Topic: RPi hung when in continuous loop
Replies: 2
Views: 573

RPi hung when in continuous loop

Hello all, I am building a project where my RPi (model B) receives some input from temp sensors and triggers some motors based on my .py software running. The thing is that we need 24X7 availability and we noticed that the RPi crashes after a while running my .py software. The software is basically ...
by michaelperakis
Fri Jul 25, 2014 3:35 pm
Forum: Troubleshooting
Topic: SD Card bad sectors when reading/writing files
Replies: 3
Views: 671

SD Card bad sectors when reading/writing files

Dear all, I am in the middle of a project trying to produce some text files which are written to the SD card every 5 seconds. These are about 20 .txt files having some text inside adding it to the previous existing text in each file (appending) I am using python. The problem is that after about 2 we...
by michaelperakis
Tue Jun 10, 2014 8:28 pm
Forum: Python
Topic: Write over already existing text in a text file
Replies: 10
Views: 1663

Re: Write over already existing text in a text file

Yes, this is my original thought but I would rather avoid to frequent opening and closing files.
It would be great if I could open once, search and close the file.

I am afraid of frequent open/close. Please note that this will be inside a while true: Loop, so it will happen forever !
by michaelperakis
Tue Jun 10, 2014 4:55 pm
Forum: Python
Topic: Write over already existing text in a text file
Replies: 10
Views: 1663

Re: Write over already existing text in a text file

This is not correct because you dont know that the string you are searching does not appear elsewhere also. So if I open and search for a string in a file, I will replace all same strings in a file. I need to replace the specific string (which may appear in several places) beneath the search string ...
by michaelperakis
Tue Jun 10, 2014 12:32 am
Forum: Python
Topic: Write over already existing text in a text file
Replies: 10
Views: 1663

Write over already existing text in a text file

Dear all, I was wondering how it is possible to do the next in python: a. find specific text in a text file b. when found, write exactly underneath it a string, overwriting any previous string existing there. Example: some string to be found some string to overwrite <--- this is the string that get ...
by michaelperakis
Sun Jun 01, 2014 12:42 pm
Forum: Python
Topic: Assign GPIO to variables
Replies: 2
Views: 1338

Re: Assign GPIO to variables

Great that is what I needed...! :D
by michaelperakis
Sun Jun 01, 2014 12:40 pm
Forum: Beginners
Topic: GPIO18 is not responding
Replies: 1
Views: 436

GPIO18 is not responding

Dear all, Can someone tell me why GPIO18 (12 on RPi board) is not responding? I have set it to input and send 1 (true) via 3v3 V from the breadboard but the value is remaining 0. This is not the case with every other GPIO on board when connected to a logical 1, under same conditions. Why is this hap...
by michaelperakis
Wed May 28, 2014 11:55 pm
Forum: Python
Topic: Assign GPIO to variables
Replies: 2
Views: 1338

Assign GPIO to variables

Dear all, I am not a programmer, neither have experience in python. I want to write code that will do the following: Given a table of 2 columns where in the first column we have GPIO numbers and in the second commands to execute, I want to write code that would automatically assign GPIO numbers to v...
by michaelperakis
Thu Jan 23, 2014 9:22 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19811

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

Sorry for not responding a few days now, I was busy with other issues. I have fixed the code, which I am posting naked without any unnecessary rems: import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) print "Waiting for rising edge on port 18" try: GPIO...
by michaelperakis
Mon Jan 20, 2014 11:06 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19811

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

If you want to wait for interrupts, and for the code to wait until it happens, you need "threaded = False" I think. Changed to threaded = False but still the code isnt runing as expected since I get a sequence of messages: New value for GPIO 18: 1 and when the button is pressed, the sequence just s...
by michaelperakis
Mon Jan 20, 2014 9:37 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19811

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

Yes, the modified code is the following: import RPIO RPIO.setup(18, RPIO.IN) RPIO.setmode(RPIO.BCM) def do_something(gpio_id, value): print("New value for GPIO %s: %s" % (gpio_id, value)) RPIO.add_interrupt_callback(18, do_something, edge='rising',debounce_timeout_ms=100) RPIO.wait_for_interrupts(th...
by michaelperakis
Sun Jan 19, 2014 11:15 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19811

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

ok, got it.

Added the missing code and also threaded=True @ RPIO.wait_for_interrupts(), but now nothing is happening when I press the button...
I was expecting to have an output signaling the 'button pressed' change of state...

Please advice since obviously I am missing something...
by michaelperakis
Sun Jan 19, 2014 10:44 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19811

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

The error code received: /home/pi$ sudo python test4.py Traceback (most recent call last): File "test4.py", line 8, in <module> RPIO.add_interrupt_callback(19, do_something, edge='both', threaded_callback=True) File "/usr/local/lib/python2.7/dist-packages/RPIO-0.10.0-py2.7-linux-armv6l.egg/RPIO/__in...
by michaelperakis
Sun Jan 19, 2014 7:18 pm
Forum: Python
Topic: RPIO: An extension of RPi.GPIO with interrupts, PWM and more
Replies: 84
Views: 19811

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

Dear all, I use the following code: import RPIO def do_something(gpio_id, value): print("New value for GPIO %s: %s" % (gpio_id, value)) RPIO.add_interrupt_callback(17, do_something, edge='rising') RPIO.add_interrupt_callback(18, do_something, edge='falling') RPIO.add_interrupt_callback(19, do_someth...

Go to advanced search