Commit bbd0a828 authored by Cédric Bonhomme's avatar Cédric Bonhomme

When none of the stop conditions is met, wait a little before sending the...

When none of the stop conditions is met, wait a little before sending the response. Should fixes #8. To test.
parent c9d81b89
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
__author__ = "Cedric Bonhomme" __author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.2 $" __version__ = "$Revision: 0.3 $"
__date__ = "$Date: 2015/11/05$" __date__ = "$Date: 2015/11/05$"
__revision__ = "$Date: 2015/11/08 $" __revision__ = "$Date: 2015/11/10 $"
__copyright__ = "Copyright (c) 2014-2015 Cédric Bonhomme" __copyright__ = "Copyright (c) 2014-2015 Cédric Bonhomme"
__license__ = "" __license__ = ""
...@@ -28,6 +28,7 @@ def stop(motorA, motorB): ...@@ -28,6 +28,7 @@ def stop(motorA, motorB):
""" """
motorA.stop() motorA.stop()
motorB.stop() motorB.stop()
time.sleep(0.6)
def check_stop_condition(motorA, motorB): def check_stop_condition(motorA, motorB):
""" """
...@@ -40,7 +41,6 @@ def check_stop_condition(motorA, motorB): ...@@ -40,7 +41,6 @@ def check_stop_condition(motorA, motorB):
if button.is_pushed: if button.is_pushed:
# stop the motor # stop the motor
stop(motorA, motorB) stop(motorA, motorB)
time.sleep(0.5)
# go a few centimers backward # go a few centimers backward
motorA.position = 0 motorA.position = 0
motorA.run_position_limited(position_sp=180, speed_sp=800, motorA.run_position_limited(position_sp=180, speed_sp=800,
...@@ -57,6 +57,8 @@ def check_stop_condition(motorA, motorB): ...@@ -57,6 +57,8 @@ def check_stop_condition(motorA, motorB):
if color_sensor.colors[color_sensor.color] == "red": if color_sensor.colors[color_sensor.color] == "red":
stop(motorA, motorB) stop(motorA, motorB)
result_message.append("in_target") result_message.append("in_target")
else:
time.sleep(0.5)
return ";".join(result_message) if len(result_message) != 0 else "OK" return ";".join(result_message) if len(result_message) != 0 else "OK"
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
__author__ = "Cedric Bonhomme" __author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.5 $" __version__ = "$Revision: 0.6 $"
__date__ = "$Date: 2014/12/15$" __date__ = "$Date: 2014/12/15$"
__revision__ = "$Date: 2015/11/08 $" __revision__ = "$Date: 2015/11/10 $"
__copyright__ = "Copyright (c) 2014-2015 Cédric Bonhomme" __copyright__ = "Copyright (c) 2014-2015 Cédric Bonhomme"
__license__ = "" __license__ = ""
import time
from flask import render_template, request, session, url_for, redirect from flask import render_template, request, session, url_for, redirect
from ev3.ev3dev import Motor from ev3.ev3dev import Motor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment