Go to advanced search

by RogerW
Wed Jul 15, 2015 3:49 pm
Forum: Beginners
Topic: GPIO
Replies: 5
Views: 752

Re: GPIO

If you are going to drive a MCP3008 directly from the GPIO pins you will probably have to use a python library. Spidev is one possibility, pigpio is another. This code uses pigpio. # pio.py # classes using Pigpio # written by Roger Woollett import pigpio as pg import socket as soc class Pio(): # to ...
by RogerW
Wed Jul 15, 2015 2:06 pm
Forum: Beginners
Topic: GPIO
Replies: 5
Views: 752

Re: GPIO

Unlike the Arduino the RPi does not have any analog input pins. You will have to use an external device. The MCP3008 is one possibility.
by RogerW
Sat Jul 11, 2015 5:13 pm
Forum: Beginners
Topic: Python error; 'NoneType' object has no attribute 'after'
Replies: 1
Views: 1656

Re: Python error; 'NoneType' object has no attribute 'after'

try changing

Code: Select all

root = App1(None)
to

Code: Select all

root = App1()
You are passing None to the __init__ function as master.
by RogerW
Thu Jul 09, 2015 1:58 pm
Forum: Beginners
Topic: VGA Monitor
Replies: 10
Views: 1754

Re: VGA Monitor

by RogerW
Thu Jul 09, 2015 1:26 pm
Forum: Other projects
Topic: 3D scan rig (possibly 100+ Raspberries)
Replies: 5
Views: 1375

Re: 3D scan rig (possibly 100+ Raspberries)

You say It is necessary for the RPis to take a photo exactly at the same time . Strictly speaking this is impossible. What you can do is have all the RPis take their photos within a given time. It would be helpful to know what would be acceptable. If this is measured in nanoseconds you will have pro...
by RogerW
Thu Jul 02, 2015 9:57 am
Forum: Networking and servers
Topic: Pi as local network (no internet) router
Replies: 5
Views: 808

Re: Pi as local network (no internet) router

An additional question. Can another computer (pi or pc) ssh into the router pi and run programs on it in addition to its routing function?
by RogerW
Tue Jun 30, 2015 2:45 pm
Forum: Automation, sensing and robotics
Topic: Programming for a ship model
Replies: 3
Views: 612

Re: Programming for a ship model

Since noone else has responded I will start the ball rolling. I have no direct experience so I hope others will add some detail or correct me if I am totally wrong. You do not say what range you will need. If this is limited to around 100m then I can see two options. Put wiFi dongles in bothe pis an...
by RogerW
Wed Jun 17, 2015 10:48 am
Forum: General programming discussion
Topic: Which language?
Replies: 30
Views: 3903

Re: Which language?

The designers of C++ have gone to a lot of trouble to ensure it can be implemented efficiently but that depends critically on the compiler writer. It is possible to generate fast efficient code but that may not always be done. It also relies on the user setting compile flags appropriately and maybe ...
by RogerW
Sun Jun 14, 2015 11:22 am
Forum: Python
Topic: Very strange behavior (time.strftime() kills main thread ??)
Replies: 30
Views: 2883

Re: Very strange behavior (time.strftime() kills main thread

There's plenty of documentation at http://raspberrypi.org/forums since it's the #1 most popular subject. The official RPF docs for GPIO are at: https://www.raspberrypi.org/documentation/usage/gpio/README.md https://www.raspberrypi.org/documentation/usage/gpio-plus-and-raspi2/README.md The forum has...
by RogerW
Sun Jun 14, 2015 10:30 am
Forum: Python
Topic: Very strange behavior (time.strftime() kills main thread ??)
Replies: 30
Views: 2883

Re: Very strange behavior (time.strftime() kills main thread

DougieLawson wrote:The "official" docs are here: http://sourceforge.net/p/raspberry-gpio ... wiki/Home/
You are probably right but all I could find there was sample code.

Since the use of the GPIO pins sems to be a fundamental aim of the RPF I am surprised that there is not proper documentation on this site.
by RogerW
Sun Jun 14, 2015 10:08 am
Forum: Python
Topic: Very strange behavior (time.strftime() kills main thread ??)
Replies: 30
Views: 2883

Re: Very strange behavior (time.strftime() kills main thread

I can again confirm that even a different time module (datetime) stops the program execution. All this program is supposed to do is detect a rising edge, detect a falling edge and print the time. What am I supposed to feel? Having these kinds of problems on such a simple program, with no error mess...
by RogerW
Fri Jun 12, 2015 2:39 pm
Forum: Python
Topic: Newbie to Raspberry Pi 2 and Python needs your advice
Replies: 10
Views: 985

Re: Newbie to Raspberry Pi 2 and Python needs your advice

I'm 68 years old and still programming - I remember punching in Hex into some Heath Kit that had 4 K memory and thought I was in heaven then... So a newbie then. My first programs were on 5 hole paper tape sent by van to a Ferranti computer that used valves (vacuum tubes) not transistors. Seriously...
by RogerW
Fri Jun 12, 2015 1:26 pm
Forum: Python
Topic: Newbie to Raspberry Pi 2 and Python needs your advice
Replies: 10
Views: 985

Re: Newbie to Raspberry Pi 2 and Python needs your advice

Hi - this is my first post to what looks like a fantastic resource for us developers! What I'm trying to do: I'm building a device that controls up to 40 servo motors and each one must be turned on and off to a tolerance of 1/10 of a second. I've played with the Arduino and got one servo working, b...
by RogerW
Tue Jun 09, 2015 2:23 pm
Forum: Beginners
Topic: Sending emails triggered by input
Replies: 2
Views: 7585

Re: Sending emails triggered by input

If you are using python to detect the switch then you might look at smtplib which is a standard python import. I have not tried it myself but it should allow you to send an email although you will have to set up all the details. There may be an easier an easier way but since nobody else has replied ...
by RogerW
Sun May 24, 2015 2:32 pm
Forum: General programming discussion
Topic: Programming club at school
Replies: 9
Views: 1469

Re: Programming club at school

scidata wrote: That rules out 99.9% of all tutorials and documentation presently out there.
That may be true - but desirable? To be clear I am not suggesting that sample code should not be reused. However in my opinion it is worth looking at how and why code works and if possible improving it.

Roger Woollett
by RogerW
Sun May 24, 2015 9:45 am
Forum: General programming discussion
Topic: Programming club at school
Replies: 9
Views: 1469

Re: Programming club at school

I would stick to python until you really understand it. Don't just cut and paste other peoples code - understand what is going on and learn to use the manual. Do try to understand classes and the object oriented approach to programming. Look at some of the many python libraries - tkinter for graphic...
by RogerW
Tue May 19, 2015 11:49 am
Forum: Automation, sensing and robotics
Topic: Analog I/P's and a GUI
Replies: 5
Views: 1595

Re: Analog I/P's and a GUI

These bits would enable you to implement a GUI in python. This file implements an ADC class which would allow you to read the ADC. It uses joan's pigpio but could be modified to use spidev. # Objects implemented using joan's pigpio # written by Roger Woollett import pigpio as pg import socket as soc...
by RogerW
Fri May 15, 2015 8:46 am
Forum: Automation, sensing and robotics
Topic: Controlling a 1.9V motor
Replies: 5
Views: 868

Re: Controlling a 1.9V motor

If you want to do your own controller you might use one half of an H Bridge chip like this one http://www.hobbytronics.co.uk/electronic-components/misc-ic/h-bridge-driver-sn754410 I would suggest you do not use the pi to power the motor. Use an external 2 volt supply. A 1.5 volt battery would probab...
by RogerW
Thu May 14, 2015 2:05 pm
Forum: Python
Topic: A python prog to take picamera pictures
Replies: 0
Views: 950

A python prog to take picamera pictures

Give the interest in the piCamera and photo booths etc I thought it might be of interest to show this program which takes a 640x480 (you can change this) picture and displays it in a tkinter GUI program. Hopefully it might provide the basis for other programs. from sys import version_info if version...
by RogerW
Thu May 14, 2015 1:53 pm
Forum: Advanced users
Topic: How to change username
Replies: 3
Views: 603

Re: How to change username

I always create a new user id (I use the same id/passwrd) on all my machines. Having created the new id make it a sudoer and then join it to all the groups that pi is a member of.

To see what groups pi belongs to - groups pi
To join a user to a group - adduser id group

Roger Woollett
by RogerW
Wed May 13, 2015 8:40 am
Forum: Python
Topic: Error from pigpio.spi_close()
Replies: 13
Views: 1766

Re: Error from pigpio.spi_close()

Thanks for all your help. I now have ADC and Motor classes working. The ADC (MCP3008) I have tested and seems ok. The Motor clas looks good on a scope but I need to rig up an H bridge and motors to test it. import pigpio as pg import socket as soc class Pio(): # to override the default host name (ip...
by RogerW
Tue May 12, 2015 12:43 pm
Forum: Python
Topic: Error from pigpio.spi_close()
Replies: 13
Views: 1766

Re: Error from pigpio.spi_close()

I think I am going to have to admit defeat for the moment and require all pigpio based classes to implement a close(). I think I can provide a base class __del__ which checks for closure and throws an exeption if it has not been done. It means that in a GUI I have to explicitely trap when the window...
by RogerW
Tue May 12, 2015 10:46 am
Forum: Python
Topic: Error from pigpio.spi_close()
Replies: 13
Views: 1766

Re: Error from pigpio.spi_close()

Roger, could you not explicitly do what you have in the __del__ method? (Bearing in mind the warning by @joan that you *do* need to do this) Along the lines of: import pigpio as pg pi = pg.pi() class ADC(): def __init__(self): self.handle = pi.spi_open(0,50000,0) def spi_close(self): pi.spi_close(s...
by RogerW
Tue May 12, 2015 10:18 am
Forum: Python
Topic: Error from pigpio.spi_close()
Replies: 13
Views: 1766

Re: Error from pigpio.spi_close()

Unfortunately python does not have pointers or references - maybe I can manipulate the reference count in the pi object. A a matter of fact, python does have object references... some people confuse them with variables. An object reference count is maintained that prevents garbage collection from c...
by RogerW
Tue May 12, 2015 10:02 am
Forum: Python
Topic: Error from pigpio.spi_close()
Replies: 13
Views: 1766

Re: Error from pigpio.spi_close()

I think you are right Paddy. The pi object appears before the ADC one and will probably be destroyed first. I think I need to find a way to keep a reference to it in the ADC object so it cannot be destroyed first. Unfortunately python does not have pointers or references - maybe I can manipulate the...

Go to advanced search