Go to advanced search

by davef21370
Fri Oct 04, 2013 3:50 pm
Forum: Python
Topic: Serial library help
Replies: 4
Views: 1350

Re: Serial library help

Could try catching the exception...

Code: Select all

import serial
port=serial.Serial("dev/ttyAMA0",baudrate=57600,timeout=3.0)

while True:
    try:
        out=port.readline()
        print(out)
    except:
        pass
Dave.
by davef21370
Wed Oct 02, 2013 6:28 pm
Forum: C/C++
Topic: Building opencv is failing with a make error
Replies: 11
Views: 14342

Re: Building opencv is failing with a make error

Sorry, wrong link, try this...
http://mitchtech.net/raspberry-pi-opencv/

That's what I used to install on wheezy.
Dave.
by davef21370
Wed Oct 02, 2013 5:45 pm
Forum: Python
Topic: Python Factorizing help!
Replies: 2
Views: 763

Re: Python Factorizing help!

ednl's link will give you the result you want but obviously don't copy and paste stuff from Wikipedia, it's a dead giveaway that you've not done the work yourself. The task says to think about the algorithms so start there. Get your number, let's call it 'N'. The highest factor of N will be N/2, cal...
by davef21370
Mon Sep 30, 2013 5:37 pm
Forum: C/C++
Topic: Code to generate real-time sound
Replies: 37
Views: 11959

Re: Code to generate real-time sound

You could build a WAV format file and play that, simple(ish) format, have a look here...
https://ccrma.stanford.edu/courses/422/ ... aveFormat/

Dave.
by davef21370
Mon Sep 30, 2013 5:26 pm
Forum: C/C++
Topic: Building opencv is failing with a make error
Replies: 11
Views: 14342

Re: Building opencv is failing with a make error

Have a look at this post....
http://www.raspberrypi.org/phpBB3/viewt ... cv#p402953
...took a while but installed okay.

Dave.
by davef21370
Mon Sep 30, 2013 4:43 pm
Forum: Python
Topic: LCD Python programing live typing.
Replies: 3
Views: 1190

Re: LCD Python programing live typing.

If you need to update the screen as the user types you could use the getch() function from the curses module and build the string to display on the fly.

Dave.
by davef21370
Sat Sep 28, 2013 5:34 pm
Forum: Python
Topic: Facebook from Python??
Replies: 0
Views: 357

Facebook from Python??

I've just installed the Python Facebook module using

Code: Select all

sudo apt-get install python-facebook
and all went well.
Now I can't seem to find a working example of how to use it. Just want to try basic stuff, any ideas ?

Dave.
by davef21370
Fri Sep 27, 2013 9:10 pm
Forum: Python
Topic: Text- Based RPG?
Replies: 10
Views: 2898

Re: Text- Based RPG?

Python 2.7 all the way but the GUI is something I'll need to work on, it'll make things so much easier, just need a little time (winter :) )

Dave.
by davef21370
Fri Sep 27, 2013 5:49 pm
Forum: Python
Topic: Text- Based RPG?
Replies: 10
Views: 2898

Re: Text- Based RPG?

Okay, as I've already said this project was abandoned halfway through so it's far from complete but this is an example of the core of the program. from tba_constants import * # Non-interactive objects. class obj_sword(object): def __init__(self): self.catagory = OBJ_CAT_WEAPON self.state = OBJ_NO_EX...
by davef21370
Wed Sep 25, 2013 6:37 pm
Forum: Python
Topic: Text- Based RPG?
Replies: 10
Views: 2898

Re: Text- Based RPG?

If you can wait until weekend I'll post some code for, in my opinion, the best way to create a text based adventure. I started it as an interesting way to show how Python classes can work then kind of abandoned it. It has one big con but the pro's far outweigh it, it just needs a workaround. And, to...
by davef21370
Mon Sep 23, 2013 4:40 pm
Forum: Python
Topic: RaspberryPi python code not working with xively
Replies: 12
Views: 2142

Re: RaspberryPi python code not working with xively

That Sticky about posting code would be great.

Had a quick look into the original problem and there is a xively module, maybe you should look at using that.

Dave.
by davef21370
Sun Sep 22, 2013 2:40 pm
Forum: Python
Topic: RaspberryPi python code not working with xively
Replies: 12
Views: 2142

Re: RaspberryPi python code not working with xively

I've no experience with xively but can give you a couple of tips on asking for help on these forums (or should that be fora?). First off always post your code between the 'Code' tags using the button above the edit box, it makes it much easier to follow, especially in Python. Secondly let us know of...
by davef21370
Sat Sep 21, 2013 4:17 pm
Forum: C/C++
Topic: 2 USB cameras, how do you control which cam to capture from?
Replies: 1
Views: 1175

Re: 2 USB cameras, how do you control which cam to capture f

Not sure about opencv but the camera(s) will be listed as /dev/video0, /dev/video1, /dev/video2, etc. so yes, you can have multiple cameras attached.

Dave.
by davef21370
Sat Sep 21, 2013 3:29 pm
Forum: Raspberry Pi OS
Topic: sudo halt question
Replies: 3
Views: 990

sudo halt question

I use sudo halt to shut down the Pi but after a few seconds the video stops (HDMI) so how do I know when the Pi has shut down and safe to unplug?

Dave.
by davef21370
Sat Sep 21, 2013 3:18 pm
Forum: General discussion
Topic: Is Shareware Dead ??
Replies: 19
Views: 3301

Is Shareware Dead ??

Having had the Pi and using Linux for the last 12 months I couldn't help but notice that all the software seems to be commercial or free with no middle ground for making a few quid on the side ;) Back in the day (this makes me feel really old when I'm actually only a bit old) we had shareware, if yo...
by davef21370
Sat Sep 21, 2013 11:10 am
Forum: C/C++
Topic: Access Python array in C module
Replies: 0
Views: 493

Access Python array in C module

I'm writing a Python module in C that needs to access a 3D PyGame surfarray, here's the function where 'pix' is the surfarray... static PyObject *pycmod_scan(PyObject *self, PyObject *args) { PyObject pix; if (!PyArg_ParseTuple(args, "O", &pix)) return NULL; return 0; } ... How do I convert pix to a...
by davef21370
Sat Sep 21, 2013 7:30 am
Forum: Python
Topic: Panel applet showing network status
Replies: 9
Views: 2767

Re: Panel applet showing network status

If you just need to display some text in a window have a look at Tkinter, there are loads of examples online, you'll just need to add the network info part.

Dave.
by davef21370
Tue Sep 17, 2013 5:12 pm
Forum: Java
Topic: Java Programming Course
Replies: 1
Views: 1573

Java Programming Course

Just thought some of you may be interested in this. The Open University have started a series of online courses called FutureLearn. There is quite a diverse range of subjects, one of them being an introduction to programming Java. As I understand it's a 7 week course at just 3 hours per week so easi...
by davef21370
Sat Sep 14, 2013 11:50 am
Forum: Python
Topic: Python Module In C Problem
Replies: 1
Views: 625

Re: Python Module In C Problem

Think this is sorted, I need 2 I's in the ParseTuple function.
Makes sense now.

Dave.
by davef21370
Sat Sep 14, 2013 11:14 am
Forum: Python
Topic: Python Module In C Problem
Replies: 1
Views: 625

Python Module In C Problem

I'm trying to write a Python module in C. For now it only has 1 function which should return the sum of 2 integers (purely for testing purposes). It builds okay and I can import the module and call the function but with the following error... Traceback (most recent call last): File "/home/pi/Desktop...
by davef21370
Fri Sep 13, 2013 12:39 pm
Forum: Python
Topic: Pi Car
Replies: 1
Views: 638

Re: Pi Car

Google RPi.GPIO and look at some examples, there's loads out there for motor and servo control.

Dave.
by davef21370
Fri Sep 13, 2013 12:36 pm
Forum: Python
Topic: Using python to call C/C++ functions?
Replies: 2
Views: 3310

Re: Using python to call C/C++ functions?

You can write modules in C then call them from Python...http://docs.python.org/2/extending/extending.html.

Dave.
by davef21370
Wed Sep 11, 2013 11:57 am
Forum: Python
Topic: GPIO install
Replies: 6
Views: 5889

Re: GPIO install

I've a feeling RPi.GPIO comes with the latest Debian installation but could be wrong. Run IDLE and type "import RPi.GPIO", if you don't get an error it's installed. If you don't have it have a look here http://www.raspberrypi-spy.co.uk/2012/05/install-rpi-gpio-python-library/ but be aware it's an ol...
by davef21370
Wed Sep 11, 2013 11:46 am
Forum: Python
Topic: SENDING DATA FROM HTML TO A PYTHON PROGRAM in RPi
Replies: 8
Views: 11672

Re: SENDING DATA FROM HTML TO A PYTHON PROGRAM in RPi

Have you tried

Code: Select all

<form action="python /exec/serialtest.py" method="POST">
in you HTML file?

Note the "python" before /exec/serialtest.py.
May work.

Dave.

Go to advanced search