Go to advanced search

by papous
Thu Feb 15, 2018 12:52 pm
Forum: Troubleshooting
Topic: can not connect to my pi3
Replies: 2
Views: 270

can not connect to my pi3

Hello all I thought that this was going to happen and I did not take the appropriate backup... So, I was trying to create a access point and was following instructions found in this forum. This did not work so I tried following different instructions and then different ones. Now although my phone de...
by papous
Mon Feb 12, 2018 7:58 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

I was wrong about the dictionary object. It does not work
Sorry...
by papous
Sun Feb 11, 2018 7:25 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

paddyg, after a few days of abstinence from python, I thought you might be interested inn this: Another way of shifting values around is to use the dictionary object which by its nature is a global object. So, you can store key-value pairs in it and retrieve them very easily from anywhere in the cod...
by papous
Sat Feb 03, 2018 6:10 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

Thanks for following up. I did try to use mmap but as you said, a) it needs a physical file to read and write and b) I could not move the file contents around functions. I also tried StringIO, that reads and writes a string buffer ( https://docs.python.org/2/library/stringio.html ) but I had no joy ...
by papous
Thu Feb 01, 2018 5:56 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

I am sorry about this.This line
t = threading.Thread(target=loop_func())
should have been
t = threading.Thread(target=loop_func)
That is what stopped the program working
by papous
Wed Jan 31, 2018 9:42 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

Well, here I am again The code below was working fine until yesterday from flask import Flask,render_template, url_for, request, redirect, session import os.path from time import sleep import motor import distance import threading from myfunc import read_write_file read_write_file('w+','SS') tdist=[...
by papous
Sun Jan 28, 2018 11:57 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

thanks for the tip. I'll a go at it myself
by papous
Fri Jan 26, 2018 5:37 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

Well, I did try using a file read/write method and I am happy to report that it does work.
I will though take your advice and use an sqlite in memory DB which I used before.
Your help and advice has been greatly appreciated. Especially the threading solution
Thank you
by papous
Thu Jan 25, 2018 7:42 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

Thank you paddyg. Good comic.
I'll try to go down that road and let you know.
Just out of curiosity, why use a DB like sqlite and not use a text file to store a couple of values?
by papous
Wed Jan 24, 2018 10:03 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

thank you so much for the help understanding how the code should be written Unfortunately this way of doing things (using session) as well as using Flask.g for storing values does not seem to work. The error that I get on both occasions is RuntimeError: Working outside of request context This typica...
by papous
Tue Jan 23, 2018 8:26 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

I tried to conform to paddyg 's suggestions, so here is a very cut down code from flask import Flask,render_template, url_for, request, redirect, session from time import sleep import motor import distance tdist=[] app=Flask(__name__) app.secret_key = 'You Will Never Guess' @app.route('/') def index...
by papous
Mon Jan 22, 2018 12:20 pm
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Re: Robot web control and distance sensor working in parallel

Thank you paddyg for the very quick reply and your input.
I will try to effect the changes suggested and report back
Frank
by papous
Mon Jan 22, 2018 7:25 am
Forum: Python
Topic: Robot web control and distance sensor working in parallel
Replies: 19
Views: 2163

Robot web control and distance sensor working in parallel

I built a robot that is controlled from a web app (using flask). The robot has a distance sensor. The object of the exercise is: while the robot is “driven", if an object is detected, it should stop. Basically it should listen to the web form all the time so it can detect the keypress and also check...
by papous
Mon Jan 15, 2018 6:33 pm
Forum: Python
Topic: Raspberry LX terminal odd behaviour
Replies: 3
Views: 435

Re: Raspberry LX terminal odd behaviour

Dave thanks so much for your reply. It actually worked. I even reduced the sleep period to 1 and it is ok It sounds though that the engines 'initiate' at the point of pwmMotorAForwards.start(0) pwmMotorABackwards.start(0) pwmMotorBForwards.start(0) pwmMotorBBackwards.start(0) That's no problem but d...
by papous
Sat Jan 13, 2018 7:43 pm
Forum: Python
Topic: Raspberry LX terminal odd behaviour
Replies: 3
Views: 435

Raspberry LX terminal odd behaviour

Below there is a fairly simple module to move the two engines that came with Camjam edukit#3. When run from the Thonny platform it works ok. When run fron thw LX terminal or IDLE the engines run erratically, stopping and turning back and forward for about 5 secbefore they resume a (almost) normal op...
by papous
Thu Jan 11, 2018 7:22 pm
Forum: Automation, sensing and robotics
Topic: CamJam engine erratic behaviour
Replies: 8
Views: 928

Re: CamJam engine erratic behaviour

Back on the same subject, I am using a new set of batteries with ~6V. The engine behaviour remains the same. Here is peculiar thing however: If I run a module 'motors' code below taken from CamJam EduKit 3) the engines run at the same speed without any problems. If I call a function from module 'mot...
by papous
Mon Jan 08, 2018 9:30 pm
Forum: Python
Topic: Help with code weirdness
Replies: 3
Views: 367

Re: Help with code weirdness

solved it
removing try: loop makes the thing work

Thanks
by papous
Mon Jan 08, 2018 9:26 pm
Forum: Python
Topic: Help with code weirdness
Replies: 3
Views: 367

Re: Help with code weirdness

You are right.
The first code will return the median of 10 values from the distance sensor.
I tried to 'convert' it to a function and I only get 1 reading. trying to unindent the RETURN keyword produces the syntax error: invalid syntax
thank you

Raspberry3B
by papous
Mon Jan 08, 2018 8:44 pm
Forum: Python
Topic: Help with code weirdness
Replies: 3
Views: 367

Help with code weirdness

Why does this works (with the distance sensor)? import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) TRIG = 17 ECHO = 18 tdist=[] dist=0 #print ("Distance Measurement In Progress") GPIO.setup(TRIG,GPIO.OUT) GPIO.setup(ECHO,GPIO.IN) GPIO.output(TRIG, False) #print ("Wait...
by papous
Sun Jan 07, 2018 12:23 pm
Forum: Automation, sensing and robotics
Topic: CamJam engine erratic behaviour
Replies: 8
Views: 928

Re: CamJam engine erratic behaviour

Thank you so much for your replies. I checked my wiring and tis OK, so I'll go for a suitable powerbank
Thanks again
by papous
Sat Jan 06, 2018 7:28 am
Forum: Automation, sensing and robotics
Topic: CamJam engine erratic behaviour
Replies: 8
Views: 928

Re: CamJam engine erratic behaviour

Thank you pcmanbob for the quick reply.
I did read Mark1953 post and replies. It seems that it was not faulty wiring and he (nearly) solved the problem using a different power supply and this is why I am asking if a power bank might be a solution.
what is your view on that?
by papous
Fri Jan 05, 2018 7:11 pm
Forum: Automation, sensing and robotics
Topic: CamJam engine erratic behaviour
Replies: 8
Views: 928

CamJam engine erratic behaviour

I am trying to assemble and run a CamJam robot and I have run into similar problems with Mark53 ( https://www.raspberrypi.org/forums/viewtopic.php?t=185814 ). The motors behave erratically, stopping and restarting at (their) will. The Raspberry is 3B and the engine batteries are new rechargeable sho...

Go to advanced search