Go to advanced search

by Alan Johnstone
Fri Feb 08, 2013 1:24 pm
Forum: Python
Topic: unpickle many objects
Replies: 2
Views: 478

unpickle many objects

Could somebody tell me how to unpickle an unknown number of objects from a file. The following code works but there must be a more pythonesc way of doing it from pickle import * outFile=open("test.file",'w') l1=[1,2,3,4] dump(l1,outFile) v1=67 dump(v1,outFile) s1="string" dump(s1,outFile) l2=[3,4] d...
by Alan Johnstone
Fri Feb 08, 2013 10:20 am
Forum: Python
Topic: Finding Info on libraries
Replies: 3
Views: 995

Finding Info on libraries

This is a general question about where to look for documentation for libraries. I have just attached a GPS card to my RPi and I have got it going by searching the intenet for examples. But that only tells me how one peson did it and gives me very little about what else is available. As an example I ...
by Alan Johnstone
Fri Feb 01, 2013 11:42 am
Forum: HATs and other add-ons
Topic: SPI not working
Replies: 9
Views: 3392

Re: SPI not working

Unfortunately the fix of reloading is not foolproof. I ran the program several times and eventually it stops working. A brief google suggests that it is inadvisable to use the PIPE command because it can block if there is too much output. I have not found a workaround apart from to remove the whole ...
by Alan Johnstone
Mon Jan 28, 2013 6:29 pm
Forum: Python
Topic: using I2C with rev2 model
Replies: 0
Views: 401

using I2C with rev2 model

It has just taken me ages to figure out where I was going wrong
On the new rev 2 models I2C uses bus 1 not bus 0 as all the examples show.
Therefore use:
i2cdetect -y 1

to show what is connected.

In your program do something like:
import smbus as sb
bus=sb.SMBus(1) NOT 0

Then it will work

Alan
by Alan Johnstone
Mon Jan 28, 2013 10:28 am
Forum: HATs and other add-ons
Topic: SPI not working
Replies: 9
Views: 3392

Re: SPI not working

The frustrating thing is that the information is out there but almost inaccessable. I would never have thought of looking in a thread about LCDs to find out about SPI. Indeed looking through threads seems a very inefficient way of extracting information. Your manual is the only thing that makes the ...
by Alan Johnstone
Mon Jan 28, 2013 9:11 am
Forum: HATs and other add-ons
Topic: SPI not working
Replies: 9
Views: 3392

Re: SPI not working

It worked! I have spent hours looking for my stupid mistake. Thanks a lot. How did you find out what was required? I find the Raspberry Pi really frustrating. Nothing seems to work as it should.No documentation. How did you find the xref2(...) function if there is no documentation at all? I understa...
by Alan Johnstone
Sun Jan 27, 2013 7:50 pm
Forum: HATs and other add-ons
Topic: SPI not working
Replies: 9
Views: 3392

SPI not working

I have tried and tried to get dtoa.py to work without success. I can at most measure .5V when it should be over 2V The "r" value in the program gives [0,0]. What does this mean? Where can I get some documentation on spidev? Unfortunately I found the progam very hard to make sense of because what it ...
by Alan Johnstone
Sat Jan 26, 2013 3:32 pm
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

Re: pi revision

I have two thoughts 1 Even this could break especially if the file is created by humans! I rather think that it is the responsibility of the Raspberry Pi makers to make the different versions computer identifiable if they want the software on it to work. 2 The latest version has become opaque which ...
by Alan Johnstone
Sat Jan 26, 2013 9:40 am
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

Re: pi revision

Even better! I am new to python but it does seem to have some nice features although I prefere strong typing of C++ or C# def PiRevCheck(): # Function to check for which Pi Board revision we have revDict={'0002':1,'0003':2,'0004':2,'0005':2,'0006':2,'000f':2} revcheck = open('/proc/cpuinfo') cpuinfo...
by Alan Johnstone
Sat Jan 26, 2013 9:10 am
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

Re: pi revision

Perhaps better for future Updating def PiRevCheck(): # Function to check for which Pi Board revision we have revDict={'0002':1,'0003':2,'0004':2,'0005':2,'0006':2,'000f':2} revcheck = open('/proc/cpuinfo') cpuinfo = revcheck.readlines() revcheck.close() print cpuinfo[10][-5:-1] rev_num = cpuinfo[10]...
by Alan Johnstone
Fri Jan 25, 2013 9:16 pm
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

Re: pi revision

Thanks and sorry. I just thought it might ba a bit of old code lashed together when the rev2 came out
which had not been changed.
by Alan Johnstone
Fri Jan 25, 2013 8:15 pm
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

Re: pi revision

Yes it does. Thanks. That is a lot easier than looking at a file.
But is there a better way than used in the program to tell if it is a rev1,rev2 or any other future rev?
by Alan Johnstone
Fri Jan 25, 2013 3:26 pm
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

Re: pi revision

I should have said that the program does actually work because it sets the board to 2 if it cannot find the correct revision.
by Alan Johnstone
Fri Jan 25, 2013 3:20 pm
Forum: HATs and other add-ons
Topic: pi revision
Replies: 18
Views: 3086

pi revision

The revision in /proc/cpuinfo for my board says 000f. Therefore program leds-wp.py does not work as it looks for nos. from 0002-0006. I believe that it is rev2. and led-rg.py says it is rev2 (I do not know how it senses it.) Therefore I should add that to the check in the leds-wp.py program. The que...
by Alan Johnstone
Sat Jan 19, 2013 3:08 pm
Forum: Networking and servers
Topic: getting WiFi working
Replies: 9
Views: 20197

Re: getting WiFi working

I almost do not believe it. IT WORKS! Thank you very much. For the record to help anybody else: I had got it working by using wicd which is a GUI interface and that worked straight out of the box. ( http://dembtech.blogspot.co.uk/2012/09/how-to-install-wifi-on-raspberry-pi.html#!/2012/09/how-to-inst...
by Alan Johnstone
Tue Jan 15, 2013 10:10 am
Forum: Python
Topic: Python versions
Replies: 12
Views: 19646

Re: Python versions

I tried that on my machine with the same results so I tried to install it and found it was already installed. Went back and realized I had put in RPI not RPi. What a waste of time! However that is not the end of the problem because Idle3 needs root priviliges to run RPi.GPIO Tried running in LX Term...
by Alan Johnstone
Mon Jan 14, 2013 12:28 pm
Forum: Python
Topic: Python versions
Replies: 12
Views: 19646

Re: Python versions

I think it is pre installed for Python 2.7 but the IDE is using Python 3.3
How do I install it for python 3.3
by Alan Johnstone
Sun Jan 13, 2013 4:59 pm
Forum: Python
Topic: Python versions
Replies: 12
Views: 19646

Python versions

I am very new to this so please forgive me if this is basic. I tried to install RPI.GPIO but it did seem to be there. Investigation showed that I am using Python 3.2 in the IDE Looking in the /etc directory I see sub directories for: python python2.7 python3 python3.2 I also found that I had install...
by Alan Johnstone
Tue Jan 08, 2013 8:04 pm
Forum: Networking and servers
Topic: getting WiFi working
Replies: 9
Views: 20197

Re: getting WiFi working

I tried the above and initially it said sudo ifup wlan0 /etc/network/interfaces:12: option with empty value so I retyped with spaces around the "=" signs This allowed it to read the file but with the same result sudo ifup wlan0 ioctl[SIOCSIWAP]: Operation not permitted ioctl[SIOCSIWENCODEEXT]: Inval...
by Alan Johnstone
Tue Jan 08, 2013 4:45 pm
Forum: Networking and servers
Topic: getting WiFi working
Replies: 9
Views: 20197

getting WiFi working

Hope this is the correct form for this I am trying to get my Edimax USB adapter working. sudo iwlist scan shows the wireless networks in my area so I think that means it is working iwconfig shows wlan0 unassociated Nickname:"<WIFI@REALTEK>" Mode:Managed Frequency=2.412 GHz Access Point: Not-Associat...

Go to advanced search