Beispiel #1
0
#!/usr/bin/python

import time

#http://bitsandbricks.no/2014/01/19/getting-started-with-python-on-ev3/

from ev3.rawdevice import motordevice
from ev3.rawdevice import analogdevice
from ev3.rawdevice import uartdevice

from ev3 import lego

motordevice.open_device()
analogdevice.open_device()
uartdevice.open_device()

A = 0x01
B = 0x02
C = 0x04
D = 0x08

right = A
left = D
both = A + D

touch = lego.EV3TouchSensor(0)
ir = lego.EV3IRSensor(3)
ir.set_prox_mode()

motordevice.speed(both, 20)
Beispiel #2
0
 def setUpClass(cls):
     motordevice.open_device()
     motordevice.set_types([TYPE_NONE, TYPE_TACHO,TYPE_TACHO ,TYPE_NONE ])
Beispiel #3
0
import time
import ev3
from ev3.rawdevice import motordevice
from ev3.sensor.lego import EV3IRSensor
#from ev3.sensor.lego import EV3ColorSensor
from argparse import ArgumentParser

ev3.open_all_devices()

motordevice.open_device()
A = 0x01
B = 0x02
C = 0x04
D = 0x08

right = A
left = D
both = A+D

#SPEED = 50
MAX_VALUE=255



# def color_sensor_test():
# 	print "color_sensor_test"
# 	color_sensor = EV3ColorSensor(ev3.SENSOR_2)
# 	color_sensor.set_color_mode()
# 	while 1:
# 		print color_sensor.get_value()