1

I am using EV3 micropython (ev3dev?). When I upload the below program to my EV3, I see on the screen the usual play button image which looks approximately like the below ASCII art:

              _______
            /         \
           /    |\     \
          |     | \     |
          |     |  )    |
           \    | /    /
            \   |/    /
             ---------

However, the EV3 status light pulses. By "pulsing" I don't mean the light flashes on, off, on but instead that it gradually dims then brightens. I don't know what that indicates, but my program (intended to smoothly and gradually accelerate a motor by remote control) does not work. My program:

#!/usr/bin/env pybricks-micropython 
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
                                 InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import Port, Stop, Direction, Button, Color
from pybricks.tools import wait, StopWatch, DataLog
from pybricks.robotics import DriveBase
from pybricks.media.ev3dev import SoundFile, ImageFile


# This program requires LEGO EV3 MicroPython v2.0 or higher.
# Click "Open user guide" on the EV3 extension tab for more information.


# Create your objects here.
ev3 = EV3Brick()
ir = InfraredSensor(Port.S1)
pitchlm = Motor(Port.D)
yawmm = Motor(Port.B)
rollmm = Motor(Port.A)

pitchspeed = 0
rvz = 0

def remote_motor_gradual(posbutton, negbutton, increment, retvarname):
    ''' Gradually increases/decreases return value based on remote button;
    if positive value is being returned and current input is negative,
    value decreases 2x faster than if no buttons were being pressed.
    Parameters: posbutton, button to make return value go up;
    negbutton, button to make return value go down;
    increment, amount  of increment when NO button is pressed;
    retvarname, name of final-result variable (use a different one for each use,
    e.g. xretval).
    Before using retvarname, put somewhere before this def "nameyoulluse = X where X
    is the number you want the return value to be.
    '''
    if posbutton in ir.buttons(1):
        retvarname = retvarname + increment * 2
    elif negbutton in ir.buttons(1):
        retvarname = retvarname - increment * 2
    elif retvarname > 0: # if it is greater than 0
        retvarname = retvarname - increment
    elif retvarname < 0: # if it is less than 0
        retvarname = retvarname + increment
    return retvarname
while True:
    rollmm.run(remote_motor_gradual(Button.RIGHT_UP, Button.RIGHT_DOWN, .05, rvz))

1 Answer 1

1

That is just the default state of the light when pybricks-micropython starts.

You can get help with Pybricks programming at https://github.com/pybricks/support.

1
  • Oh. For some reason I had never noticed that before. Thanks. Commented Nov 27, 2020 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.