def setUpClass(cls): uartdevice.open_device()
#!/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)
// //qAndD sample python program on Ev3 // #!/usr/bin/python import time 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)