Go to advanced search

by RogerW
Wed Jan 13, 2016 1:33 pm
Forum: C/C++
Topic: GUI with C
Replies: 9
Views: 3629

Re: GUI with C

I am not sure if this will help but it might. https://github.com/RogerWoollett/PyView This is a python/tkinter program that shows different aspects of system performance (a bit like task manager). It does this by switching windows. In this case I use a menu but you might be able to use the same idea...
by RogerW
Tue Jan 12, 2016 9:55 am
Forum: General discussion
Topic: GPIO to SPI
Replies: 7
Views: 1231

Re: GPIO to SPI

Burngate wrote:Actually GPIOs 16, 17, 18 on header pins 36, 11, 12 respectively
Thanks for correcting that - I misread the comments in my code.
by RogerW
Tue Jan 12, 2016 9:30 am
Forum: General discussion
Topic: GPIO to SPI
Replies: 7
Views: 1231

Re: GPIO to SPI

PIs with 40 pin headers (A+, B+, B2) have two SPI interfaces anyway. The primary one uses GPIOs 9,10,11 and one of two chip selects 7,8. The extra port uses 19,20,21 with three chip selects 11,12,36.
by RogerW
Sun Jan 10, 2016 2:42 pm
Forum: Python
Topic: tkinter root.title
Replies: 6
Views: 2036

Re: tkinter root.title

I have just tried your code on my pi and it works the same as on my PC. I am using Rasbian Jessie, python 3.4.2 tkinter 8.6.2 Incidentally if you are using DS18B20 sensors you might find this useful. # ds18b20.py # written by Roger Woollett import os import glob import time class DS18B20: # much of ...
by RogerW
Sun Jan 10, 2016 12:44 pm
Forum: Beginners
Topic: Where to begin
Replies: 13
Views: 3196

Re: Where to begin

But it is also (still) true in Windows. MS tries to pretend otherwise, but it is still the case. I don't think that is true. Windows NT started from scratch and the graphics API was included. Command line programs still exist as does a console but they are all part of the same system. A command lin...
by RogerW
Sun Jan 10, 2016 12:15 pm
Forum: Beginners
Topic: Where to begin
Replies: 13
Views: 3196

Re: Where to begin

I started programming using a computer that had valves not transistors. I also spent many years programming Windows. As others have said Windows is a non starter on the RPi as a general purpose OS. I would resign yourself for Linux. Unless you have good reason to do otherwise go for Raspian Jessie a...
by RogerW
Sun Jan 10, 2016 9:38 am
Forum: Python
Topic: tkinter root.title
Replies: 6
Views: 2036

Re: tkinter root.title

Are you sure you are using python3? If you start idle and select help/about this will show which versions of python and tkinter you are using. I ask this because you quote Tkinter not tkinter which is the python 3 version. It may be relavent which OS you have installed - raspian Jessie has python 3....
by RogerW
Sat Jan 09, 2016 6:12 pm
Forum: Python
Topic: tkinter root.title
Replies: 6
Views: 2036

Re: tkinter root.title

Try running the app and then stretching the window sideways. Tkinter seems to not expand the window to make the title visible.

Alternatively add the line
root.geometry('300x100')
by RogerW
Mon Jan 04, 2016 3:34 pm
Forum: C/C++
Topic: GPIO and serial IF programming with C language
Replies: 3
Views: 770

Re: GPIO and serial IF programming with C language

Try with this - without redundant overhead: http://www.pieter-jan.com/node/15 This will give you bare bones access. You could also look at wiringPi. https://projects.drogon.net/raspberry-pi/ This seems to be installed as standard in Jessie. It includes all the basic GPIO functions, serial and much ...
by RogerW
Mon Jan 04, 2016 10:24 am
Forum: Beginners
Topic: Model Trains - DCC
Replies: 15
Views: 2052

Re: Model Trains - DCC

It looks possible to me but might take some research. It also depends on what you want to do with the data. This link might be useful
http://www.opendcc.de/index_e.html
They supply a decoder circuit and also a sniffer which I think allows you to monitor the DCC signals.
by RogerW
Sat Jan 02, 2016 2:56 pm
Forum: Automation, sensing and robotics
Topic: Rotary table
Replies: 3
Views: 1123

Re: Rotary table

Certainly can be done. You need a stepper motor and some drive electronics. Lots of people have done this using microcontrollers but usin a pi would certainly make a much better user interface possible.
by RogerW
Fri Jan 01, 2016 9:29 am
Forum: Automation, sensing and robotics
Topic: Ds18b20/w1-therm
Replies: 17
Views: 5411

Re: Ds18b20/w1-therm

I cannot help with your currrent problem but I expect joan is on the right track (she usually is). When you get the connection sorted this code might help. I used Raspbian Jessie so you might need to add a sudo if you are using wheezy. The first file contains a class object (DS18B20). If you do not ...
by RogerW
Wed Dec 30, 2015 5:40 pm
Forum: C/C++
Topic: Geany in c++11
Replies: 6
Views: 1870

Re: Geany in c++11

That does not look like the dialog I get when I select Build/Set Build Commands. Which version of geany are you running. I have 1.24.1. I am running on standard rasbian Jessie and geany came pre installed.
by RogerW
Wed Dec 30, 2015 2:06 pm
Forum: Python
Topic: Python Tkinter GUI button hold down
Replies: 4
Views: 5255

Re: Python Tkinter GUI button hold down

hold_down = root.bind('<ButtonRelease-1>',stop_motor) is not doing what you expect. The function bind sets another function (stop_motor) when the button is released. It should not be called in a loop. I suggest you either examine your code and work out where it is not working or use mine as a new st...
by RogerW
Wed Dec 30, 2015 11:42 am
Forum: C/C++
Topic: Geany in c++11
Replies: 6
Views: 1870

Re: Geany in c++11

When I do this there are Cancel and OK buttons at the bottom of the Set Build Commands dialog.
by RogerW
Wed Dec 30, 2015 9:45 am
Forum: Python
Topic: Python Tkinter GUI button hold down
Replies: 4
Views: 5255

Re: Python Tkinter GUI button hold down

One way to do this is to create your own type of button. import Tkinter as tk class MyBtn(tk.Button): # set function to call when pressed def set_down(self,fn): self.bind('<Button-1>',fn) # set function to be called when released def set_up(self,fn): self.bind('<ButtonRelease-1>',fn) class Mainframe...
by RogerW
Mon Dec 28, 2015 10:57 am
Forum: C/C++
Topic: segmentation fault with gcc
Replies: 23
Views: 4118

Re: segmentation fault with gcc

> global variables are initialized as zero ? Yes - as Peter() correctly pointed out. The C standard requires static variables to be initialized. However it may be considered good practice to expicitly initialize thus. FILE *file = NULL; You should also consider whether these variables need to be glo...
by RogerW
Sun Dec 27, 2015 5:52 pm
Forum: C/C++
Topic: segmentation fault with gcc
Replies: 23
Views: 4118

Re: segmentation fault with gcc

> this one, compiled fine but segmentation fault when run without parameters ./names That is hardly surprising. You have declared file and file1 to be pointers to FILE but you have not initialised them so they contain whatever junk was on the stack. You then call fclose passing what is almost certai...
by RogerW
Sun Dec 27, 2015 11:12 am
Forum: C/C++
Topic: segmentation fault with gcc
Replies: 23
Views: 4118

Re: segmentation fault with gcc

Can you create a small program that shows the problem? If you can post the code and it may be someone can spot what is going wrong.

Segmentation faults can be caused by using a pointer that is incorrect - this will often show up differently on different platforms.
by RogerW
Thu Dec 17, 2015 10:32 am
Forum: Python
Topic: IDE for tkinter programming
Replies: 3
Views: 1052

Re: IDE for tkinter programming

I don't think geany supports debugging in the way the more sophisticated IDEs do. In any case I have never set breakpoints in python - I use primitive print statements for debugging. Python does support some debugging - look for the bdb module.

Maybe someone with more experience can contribute.
by RogerW
Thu Dec 17, 2015 10:00 am
Forum: Python
Topic: IDE for tkinter programming
Replies: 3
Views: 1052

Re: IDE for tkinter programming

It is quite possible to create tkinter programs using IDLE, I am surprised to hear that it is a tkinter program. Personally I prefer geany which you can also use for C/C++ and other languages.
by RogerW
Sun Dec 13, 2015 2:32 pm
Forum: Python
Topic: Reading multiple DS18B20 with Python
Replies: 14
Views: 22814

Re: Reading multiple DS18B20 with Python

You could try this code. The first file contains a class definition for a DS18B20 object. # ds18b20.py # written by Roger Woollett import os import glob import time class DS18B20: # much of this code is lifted from Adafruit web site # This class can be used to access one or more DS18B20 temperature ...
by RogerW
Sat Dec 12, 2015 10:44 am
Forum: Beginners
Topic: Need help with Raspi B and DS1820
Replies: 5
Views: 966

Re: Need help with Raspi B and DS1820

Have you added the line dtoverlay=w1-gpio to the file /boot/config.txt This code may help you: # ds18b20.py # written by Roger Woollett import os import glob import time class DS18B20: # much of this code is lifted from Adafruit web site # This class can be used to access one or more DS18B20 tempera...
by RogerW
Sat Nov 28, 2015 5:31 pm
Forum: Beginners
Topic: First project- motorcycle dashboard
Replies: 2
Views: 1386

Re: First project- motorcycle dashboard

I think you will have to research suitable sensors. The Raspberry Pi does not have analog inputs but you can use something like an MCP3008 (ADC) chip to give you analog inputs. You will probably need to use voltage divider resistors to get any voltage you measure to the range (0 - 3.3V) >what gear I...
by RogerW
Fri Nov 27, 2015 1:57 pm
Forum: General discussion
Topic: WiFi dongle for Pi Zero
Replies: 8
Views: 1493

Re: WiFi dongle for Pi Zero

Thanks for all the comments. Looks like I am stuck with an adapter with the pimoroni one a likely choice. Now I have to decide on a temperature sensor (DS18B20 ?).

Go to advanced search