def modulo_(off=False): nb = createNumberBlock(off, 'modulo_', 'darkblue') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement('resto da divisão por') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def map2_(off=False): nb = createNumberBlock(off, 'map2_', 'darkblue') nb.addCodeElement('mapeie [0, 1024] para [0, 255]') nb.addCodeElement() nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def numericType(varName, color, off=False): nb = createNumberBlock(off, 'numericType', color) nb.varName = varName nb.addCodeElement() nb.addCodeElement(varName) nb.addCodeElement() nb.custom = True return nb
def binaryFunction(name, operator, off): nb = createNumberBlock(off, name, 'darkblue') nb.addCodeElement(operator, {'máx': 'max_', 'mín': 'min_'}) nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def random_min_max(off=False): sb = createNumberBlock(off, 'random_min_max', 'darkblue') sb.addCodeElement('aleatorio') sb.addCodeElement('<i>min</i>') sb.addArgumentHolder(createNumberBlockHolder(off, sb)) sb.addCodeElement() sb.addCodeElement('<i>max</i>') sb.addArgumentHolder(createNumberBlockHolder(off, sb)) return sb
def constrains_(off=False): nb = createNumberBlock(off, 'constrains_', 'darkblue') nb.addCodeElement('restringe') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement('entre') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement('e') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def unaryFunction(name, operator, off): nb = createNumberBlock(off, name, 'darkblue') nb.addCodeElement(operator, { '√': 'sqrt_', 'abs': 'abs_', 'arredonde': 'round_' }) nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def map_(off=False): nb = createNumberBlock(off, 'map_', 'darkblue') nb.addCodeElement('mapeie [') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement(',') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement('] para [') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement(',') nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement(']') return nb
def numericOperation(name, operator, off): nb = createNumberBlock(off, name) nb.addCodeElement() nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement( operator, { '+': 'plus', '−': 'minus', '×': 'multiply', '÷': 'divide' }) nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def millis(off=False): sb = createNumberBlock(off, 'millis', 'darkblue') sb.addCodeElement('tempo decorrido <i>(ms)</i>') return sb
def StrToInt(off=False): nb = createNumberBlock(off, 'StrToInt', 'darkblue') nb.addCodeElement("converte") nb.addArgumentHolder(createStringBlockHolder(off, nb)) return nb
def getKnob(off=False): nb = createNumberBlock(off, 'getKnob', 'purple') nb.addCodeElement('valor') nb.addVariableElement(gettext_noop('knob'), countComponents, 'component_knob') return nb
def trigonometryFunction(name, operator, off): nb = createNumberBlock(off, name, 'darkblue') nb.addCodeElement(operator, {'sen': 'sin_', 'cos': 'cos_', 'tan': 'tan_'}) nb.addArgumentHolder(createNumberBlockHolder(off, nb)) nb.addCodeElement() return nb
def getJoystickVRy(off=False): nb = createNumberBlock(off, 'getJoystickVRy', 'purple') nb.addCodeElement(gettext_noop('ordinate') + ' (y)') nb.addVariableElement('joystick', countComponents, 'component_joystick') return nb
def getThermistor(off=False): nb = createNumberBlock(off, 'getThermistor', 'purple') nb.addCodeElement(gettext_noop('temperature')) nb.addVariableElement('termistor', countComponents, 'component_thermistor') return nb
def getLdr(off=False): nb = createNumberBlock(off, 'getLdr', 'purple') nb.addCodeElement(gettext_noop('luminosity')) nb.addVariableElement('ldr', countComponents, 'component_ldr') return nb
def getNumericVar(off=False): nb = createNumberBlock(off, 'getNumericVar', 'red') nb.addCodeElement() nb.addVariableElement(TITLE_NUMERIC_VAR, numericVars) nb.addCodeElement() return nb
def analogRead(off=False): nb = createNumberBlock(off, 'analogRead', 'purple') nb.addCodeElement(gettext_noop('analog pin')) nb.addArgumentHolder(createDropdownNumberBlockHolder(off, ANALOG_PINS, nb)) nb.addCodeElement() return nb