Go to advanced search

by RogerW
Mon Sep 21, 2015 7:18 pm
Forum: Beginners
Topic: gan't get tkinter to work
Replies: 3
Views: 911

Re: gan't get tkinter to work

tkinter is the name used in python 3. I suspect you are using python2. Iether switch to python3 or change tkinter to Tkinter (with capital T).
by RogerW
Fri Sep 18, 2015 3:30 pm
Forum: Off topic discussion
Topic: PC processor to controller
Replies: 7
Views: 1699

Re: PC processor to controller

Get a Raspberry Pi and connect it to the same network as your PC. Then get pigpio fromhttp://abyz.co.uk/rpi/pigpio/ and write a program in Python or C/C++ on your PC. The PC program can then use all the GPIO pins on the Raspberry Pi.
by RogerW
Thu Sep 17, 2015 11:10 am
Forum: Python
Topic: What does Import * imply?
Replies: 6
Views: 1000

Re: What does Import * imply?

You can use import in a number of ways. As you have found import * from Tkinter allows you to use any variable, function or class in the Tkinter import library without having to qualify their names. For instance you can write myapp = Tk() The disadvantage, as gkreidl points out, is that names in Tki...
by RogerW
Mon Sep 14, 2015 1:15 pm
Forum: General discussion
Topic: Short USB lead
Replies: 26
Views: 4268

Re: Short USB lead

geppetto wrote:It is a micro to USB type A that's needed for the display.
A lead with 90 degree connectors on each end would sit neater...
My mistake - thanks.
by RogerW
Mon Sep 14, 2015 10:38 am
Forum: General discussion
Topic: Short USB lead
Replies: 26
Views: 4268

Re: Short USB lead

Will none of the regular suppliers rise to the challenge? depends who your regular suppliers are: Farnell? You are obviously more adept at searching their site than me. I usually start at CPC rather than Farnell but I doubt if that matters. However both Farnell and RS (thank you mahjongg) supply mi...
by RogerW
Mon Sep 14, 2015 9:45 am
Forum: General discussion
Topic: Short USB lead
Replies: 26
Views: 4268

Re: Short USB lead

Will none of the regular suppliers rise to the challenge?
by RogerW
Fri Sep 11, 2015 1:24 pm
Forum: General discussion
Topic: Short USB lead
Replies: 26
Views: 4268

Short USB lead

With the advent of the official Pi screen there would appear to be a market for a very short (100 - 150 mm or 4 - 6 inch) mini USB - mini USB power lead. I think portable and robot projects would use a similar lead but with one standard connector. I have searched various suppliers but can find nothi...
by RogerW
Mon Sep 07, 2015 11:08 am
Forum: Python
Topic: Should we promote an OO approach?
Replies: 20
Views: 3151

Re: Should we promote an OO approach?

Stevech is correct. OO is not the same thing as non-procedural (declarative?). And python is multi-paradigm - it is intended to be used either with, or without, its OO features. Probably the same applies to C++ - "A good C program is a C++ program" quote from Bjarne Stroustrup, long ago. However a ...
by RogerW
Mon Sep 07, 2015 8:36 am
Forum: Python
Topic: Should we promote an OO approach?
Replies: 20
Views: 3151

Re: Should we promote an OO approach?

OO and procedural programs seem to me to be different beasts. C, C++, Python, Java, javascript, etc. are all procedural languages. OO or not. Non-procedural languages are exemplified by Prolog. And arguably, SQL. I am not a computer scientist but I suspect there are many who would dispute this. C i...
by RogerW
Sat Sep 05, 2015 8:12 am
Forum: Python
Topic: Should we promote an OO approach?
Replies: 20
Views: 3151

Re: Should we promote an OO approach?

One of the claimed benefits of the OO approach is that it makes code reuse much easier and I agree that many libraries show good use of OO - tkinter for example. My worry is that beginners use these libraries without realy understanding what they are doing. I have seen many examples of working but v...
by RogerW
Fri Sep 04, 2015 8:52 am
Forum: HATs and other add-ons
Topic: Stepper motor interface
Replies: 3
Views: 715

Re: Stepper motor interface

A ULN2003A or similar is far less expensive and can be used to drive low power bipolar steppers. I have used a SN754410 H-bridge chip which is also cheap. If it helps there is a python class to drive a stepper motor in this repository. The file is pio.py. https://github.com/RogerWoollett/pio This u...
by RogerW
Tue Sep 01, 2015 8:36 am
Forum: Python
Topic: Should we promote an OO approach?
Replies: 20
Views: 3151

Re: Should we promote an OO approach?

I agree that the benefits of an OO approach show more clearly on more complex programs but I was trying to demonstrate what an OO version of a simple program might look like. The whole point of the raspberry Pi is to promote coding to young people. In my view the OO approach leads to better structur...
by RogerW
Mon Aug 31, 2015 4:36 pm
Forum: Python
Topic: Should we promote an OO approach?
Replies: 20
Views: 3151

Should we promote an OO approach?

I am struck by the fact that most of the sample code I see is distinctly procedural. Since python is an object oriented language should we be trying to promote the OO approach? As an example of what I mean this program flashes an LED on and off. # tryapp.py # written by Roger Woollett from appobject...
by RogerW
Wed Aug 19, 2015 4:04 pm
Forum: Automation, sensing and robotics
Topic: Compressor Air Pressure Gauge Logger
Replies: 5
Views: 2397

Re: Compressor Air Pressure Gauge Logger

I don't see why you should not use that sensor. All you need is a T piece in the airline and a suitable adapter to connect to a small pipe. There is no flow so a small diameter pipe shoild be fine.
by RogerW
Wed Aug 19, 2015 2:57 pm
Forum: Automation, sensing and robotics
Topic: Compressor Air Pressure Gauge Logger
Replies: 5
Views: 2397

Re: Compressor Air Pressure Gauge Logger

From the datasheet it looks as if you will have to connect the sensor to the airline with a short length of (plastic?) pipe. The 'barb' is shown as 4.93mm diameter so I guess you will need pipe of around 4.5mm i/d. That particular sensor seems to use I2C which is fine for a pi. Other variants use SP...
by RogerW
Tue Aug 18, 2015 4:01 pm
Forum: General programming discussion
Topic: Finding subsequences of a sequence
Replies: 8
Views: 1310

Re: Finding subsequences of a sequence

This may be too late and may not answer your question but I do have a way to drive multiple steppers simultaneously. I use a separate thread for each stepper and the test program has a sequence of operations for each stepper. The code is on Github https://github.com/RogerWoollett/pio This is the tes...
by RogerW
Fri Aug 07, 2015 3:54 pm
Forum: Networking and servers
Topic: Ethernet only PI or alternatives?
Replies: 12
Views: 1919

Re: Ethernet only PI or alternatives?

You could look at the Arduino Leonardo Ethernet but it will be more expensive than an A+ with an usb/ethernet adapter. The pi may have bits you do not need but it is produced in vast numbers so you gat a lot for your money.
by RogerW
Thu Aug 06, 2015 8:40 am
Forum: General discussion
Topic: ADC Raspberry Pi Code
Replies: 7
Views: 1463

Re: ADC Raspberry Pi Code

I have written a class which accesses the MCP3008 using joan's pigpio. You can see the code in the file pio.py here. Look for the class ADC.
https://github.com/RogerWoollett/pio
You could use it directly or the comments in the code might help.
by RogerW
Mon Aug 03, 2015 10:01 am
Forum: Beginners
Topic: Adding a joystick to raspberry pi
Replies: 11
Views: 2984

Re: Adding a joystick to raspberry pi

You will need some additional electronics because the Rpi does not have any analog input capability. Most people seem to use the MCP3008 chip whic has 8 analog to digital inputs and communicates with the RPi using SPI.
by RogerW
Wed Jul 29, 2015 4:34 pm
Forum: Python
Topic: python3 and psutil
Replies: 3
Views: 6387

Re: python3 and psutil

Sorry to answer my own question but it seems pip-3.2 is right,

Code: Select all

sudo apt-get update
sudo apt-get install python3-pip
sudo pip-3.2 install psutil
Many thanks for your very quick help
by RogerW
Wed Jul 29, 2015 4:11 pm
Forum: Python
Topic: python3 and psutil
Replies: 3
Views: 6387

Re: python3 and psutil

Thanks - that looks familiar. Should it be pip or pip-3.2?
by RogerW
Wed Jul 29, 2015 4:01 pm
Forum: Python
Topic: python3 and psutil
Replies: 3
Views: 6387

python3 and psutil

I recently found instructions for installing psutil for use with python3 which worked. Unfortunately I cannot find them again despite much use of google. It involved installing pip (?) first and then python3-psutil I think. Only about four commands were required. Can anyone point me in the right dir...
by RogerW
Sat Jul 25, 2015 8:18 am
Forum: Python
Topic: Scrolling graph using tkinter
Replies: 7
Views: 2646

Re: Scrolling graph using tkinter

tonywaite wrote: I can't test it for a fortnight, but look forward to using it as a template.
Do let us know how you get on.
by RogerW
Fri Jul 24, 2015 11:05 am
Forum: Python
Topic: Scrolling graph using tkinter
Replies: 7
Views: 2646

Scrolling graph using tkinter

I have been playing with a scrolling graph object. So far it works but lacks axes and legends. As new data points are added the trace scrolls left to right. More than one trace can be shown. Performance depends on the speed of updates, the width of the graph and the number of traces. The test progra...
by RogerW
Wed Jul 22, 2015 8:35 am
Forum: Beginners
Topic: freepascal compared C
Replies: 11
Views: 1785

Re: freepascal compared C

FreePascal is a ahead-of-time compiled language , isn't it ? ghans Yes it is but that is not the whole story. The C language was designed to make it possible to write very efficient compilers. In consequence it is easily possible to write valid C code that will fail to execute or give unexpected re...

Go to advanced search