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 @@
# ***** END LICENSE BLOCK *****
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.2 $"
__version__ = "$Revision: 0.3 $"
__date__ = "$Date: 2015/11/05$"
__revision__ = "$Date: 2015/11/08 $"
__revision__ = "$Date: 2015/11/10 $"
__copyright__ = "Copyright (c) 2014-2015 Cédric Bonhomme"
__license__ = ""
......@@ -28,6 +28,7 @@ def stop(motorA, motorB):
"""
motorA.stop()
motorB.stop()
time.sleep(0.6)
def check_stop_condition(motorA, motorB):
"""
......@@ -40,7 +41,6 @@ def check_stop_condition(motorA, motorB):
if button.is_pushed:
# stop the motor
stop(motorA, motorB)
time.sleep(0.5)
# go a few centimers backward
motorA.position = 0
motorA.run_position_limited(position_sp=180, speed_sp=800,
......@@ -57,6 +57,8 @@ def check_stop_condition(motorA, motorB):
if color_sensor.colors[color_sensor.color] == "red":
stop(motorA, motorB)
result_message.append("in_target")
else:
time.sleep(0.5)
return ";".join(result_message) if len(result_message) != 0 else "OK"
......
......@@ -11,13 +11,12 @@
# ***** END LICENSE BLOCK *****
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.5 $"
__version__ = "$Revision: 0.6 $"
__date__ = "$Date: 2014/12/15$"
__revision__ = "$Date: 2015/11/08 $"
__revision__ = "$Date: 2015/11/10 $"
__copyright__ = "Copyright (c) 2014-2015 Cédric Bonhomme"
__license__ = ""
import time
from flask import render_template, request, session, url_for, redirect
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