print "I Love Ruby"
print "In 5 seconds I will say Hello..."
# Halt the execution for 2 seconds:
[Link](2)
# And again for 1 second:
[Link](1)
print "3"
# And again:
[Link](1)
print "2"
# And one more time:
[Link](1)
print "1"
# If we got here, it means that 3 seconds has passed
print "...Hello world!"
----------------------------------------------
from robot import Robot
import time
robot = Robot({"communication":{"communication_manager_type":"js"}})
#start your code here:
[Link].set_power(0, 0)
----------------------------------------------------
[Link].set_power(100,100)
[Link](3)
[Link]("both")
------------------------------------------------------
[Link].set_power(-100,-100)
[Link](2)
[Link]("both")
[Link].set_power(100,100)
-------------------------------------------------------
ciclo for cuantas veces repetira el proceso
for t in range(5):
[Link].set_power(-100,-100)
[Link](2)
[Link].set_power(100,100)
[Link](6)
------------------------------------------------------------
while True:
[Link](0.01) # <---- DO NOT REMOVE
if [Link].get_speed() < 50:
# driving too slow, let's accelerate
[Link].set_power(100, 100)
else:
# driving too fast, let's brake
[Link]("both")
---------------------------------------------------------
[Link].set_speed(25, 25)
------------------------------------------------------
import time
robot = Robot({"communication":{"communication_manager_type":"js"}})
# The distance we want Ruby to drive:
desired_distance = 5 # <---- THIS IS THE ONLY PLACE YOU NEED TO EDIT
# Read GPS - this is Ruby’s starting location:
x_start, y_start, z_start = [Link].get_position()
# Initialize the current position. These values are going to change as Ruby's
driving:
x_now, y_now, z_now = x_start, y_start, z_start
# Start moving:
[Link].set_speed(80,80)
# Put execution in a loop until Ruby passed the desired distance:
while (z_now - z_start < desired_distance):
[Link](0.01) # <---- DO NOT REMOVE
# Sends Ruby’s current distance value to the console:
print (z_now)
# Read GPS again:
x_now, y_now, z_now = [Link].get_position()
# Stop moving:
[Link]("both")