I'm building an image printer using my ev3 set and several more pieces, as a project to keep me occupied while I'm stuck at home.

Here's how it looks:


I've done the build part, the way I've chosen to do this is by converting my image to binary (B/W) and reading each number in my binary array, then drawing a dot if there's a 1 or skipping the dot if there's a 0.

I'm using Ev3 Python, as that's the language I know and I found it easiest to program in, but after I created my program my brick doesn't seem to process it properly and my brick weirdly starts to draw dots in the same spot, then instantly starts to move its top arm in the same direction for much longer than its programmed to, then sort of just stops its paper-moving wheels and starts doing more weird movements.

I tested my program's values before I wrote the program, it can draw 2 dots in a line correctly spaced out, but it starts doing weird things when I give it a whole line of data to draw.

Here's my code:

#!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor
from pybricks.parameters import Port
import time

ev3 = EV3Brick()

LR = Motor(Port.C)
UD = Motor(Port.D)
FB = Motor(Port.B)

def pendown():
    UD.run_target(40, 40)
def penup():
    UD.run_target(40, -40)
def nextline():
    LR.run_target(40, 300)
    FB.run_target(40, 30)
def nextdot():
    LR.run_target(40, -30)

byteval = '''

bytevalues = list(byteval)

# wait a bit

# define grid limit

x_limit = 8
y_limit = 8
number_of_cells = x_limit * y_limit;
x = 0
# scan grid and perform action depending on cell value

while x < (number_of_cells):
    z = bytevalues[x]
    if z == '1': #draw a dot
    elif z == '0': #go to next cell value
    if (x % x_limit) == 0: #go to next line

[I'm using an 8-Bit happy face as my image]

I don't know why this weird movement is happening, I don't think it should, please help me with this issue.

  • 1
    Have you tried putting a sleep in your while loop ? Dec 12, 2020 at 9:39
  • I did, still isn't working
    – leaves
    Dec 13, 2020 at 12:37
  • Changed more values, now it drew 4 dots in a column? I'm very confused
    – leaves
    Dec 13, 2020 at 12:54
  • 2
    It could be, but you need people familiar with EV3 and ev3python.
    – leaves
    Dec 22, 2020 at 2:26
  • 1
    Yeah, it solved my problem, thanks!
    – leaves
    Dec 23, 2020 at 14:00

1 Answer 1


You are using the function run_target... which tells the motor to run to a specific angle. So it turns to an absolute position...

This might be correct for the pen_up and pen_down cases, but I think that for the movement, you want relative movement, i.e. relative from your current position, hence I think the instruction you need is run_angle instead of run_target.

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.