from __future__ import absolute_import
from roberta.ev3 import Hal
from roberta.BlocklyMethods import BlocklyMethods
from ev3dev import ev3 as ev3dev
import math

class BreakOutOfALoop(Exception): pass
class ContinueLoop(Exception): pass

_brickConfiguration = {
    'wheel-diameter': 5.6,
    'track-width': 18.0,
    'actors': {
    },
    'sensors': {
        '1':Hal.makeIRSeekerSensor(ev3dev.INPUT_1),
        '2':Hal.makeCompassSensor(ev3dev.INPUT_2),
    },
}
hal = Hal(_brickConfiguration)

def run():
    while True:
        if hal.getHiTecCompassSensorValue('2', ANGLE) < 30:
            break
        hal.waitFor(15)
    while True:
        if hal.getHiTecCompassSensorValue('2', COMPASS) < 30:
            break
        hal.waitFor(15)
    while True:
예제 #2
0
class BreakOutOfALoop(Exception):
    pass


class ContinueLoop(Exception):
    pass


_brickConfiguration = {
    'wheel-diameter': 5.6,
    'track-width': 18.0,
    'actors': {},
    'sensors': {
        '2': Hal.makeCompassSensor(ev3dev.INPUT_2),
        '3': Hal.makeHTColorSensorV2(ev3dev.INPUT_3),
        '4': Hal.makeIRSeekerSensor(ev3dev.INPUT_4),
    },
}
hal = Hal(_brickConfiguration)

___numberVar = 0
___booleanVar = True
___stringVar = ""
___colourVar = 'white'
___connectionVar = None
___numberList = [0, 0]
___booleanList = [True, True]
___stringList = ["", ""]
___colourList = ['white', 'white']
___connectionList = [___connectionVar, ___connectionVar]