Python

If you need technical help with anything you've bought from Dawn Robotics, please post here.

Python

Postby drx » Thu Oct 30, 2014 9:19 am

I really enjoyed building and playing with the Pi-camera-robot and have added the ultrasonic sensor. However I am very much a beginner and am a bit confused about the control scripts (eg the sensor example). Why is it that the script runs fine from command line but gives error messages if I try to run it through Python as a module? I also notice that some of the syntax in the script is slightly different to my VERY limited experience of Python, why is this? I have started playing with the script to try and modify the behaviours and its become a bit of a stumbling block. Thanks in advance for any reply!
drx
 
Posts: 6
Joined: Tue Oct 28, 2014 11:18 pm

Re: Python

Postby Alan » Mon Nov 03, 2014 11:20 am

Hi there,

First of all, welcome to the forums :), and sorry for the delayed reply.

Can you post an example of the script that's giving you error messages? I might be able to provide some insight. Also, what syntax differences are you seeing? Python does offer multiple ways of doing the same thing in some areas, so it may just be my particular coding 'style' that you're seeing. ;)

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: Python

Postby drx » Wed Dec 03, 2014 12:16 am

Looked at again and it was a few misunderstandings on my part and a difference in the print statement between python 2 and 3. As a separate question (sorry to muddle the threads) I have been thinking of using the robot to monitor my dogs, initially just so that when they start barking it takes a photo. Do you have any suggestions for a good sound sensor?
drx
 
Posts: 6
Joined: Tue Oct 28, 2014 11:18 pm

Re: Python

Postby Alan » Wed Dec 03, 2014 6:21 pm

Hi there,

I don't know of any specific sensors for this task, but I would say that I good way to start might be with a simple microphone, and then just monitor volume leves with the pyalsaaudio library.

Best of luck, would be interested to know how you get on.

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest