Please do not give solution in image format thanku convert this into pybricks : from project import motor from project import sensor from project import variables def feed_in(): """This will feed the paper in until it covers the light sensor. This should be done before printing anything. """ while True: motor['B'].on(-50) if sensor['4'].read_reflected() > 4: break motor['B'].off() def feed_out(): """Call when you are finished printing to feed the paper out.""" while True: motor['B'].on(50) if sensor['4'].read_reflected() < 2: break motor['B'].off() motor['B'].on_for_degrees(50, 600) def lift_pen(): """Lifts the pen off the page so that it can be moved without depositing ink. """ motor['C'].on_for_degrees(25, 180) def line_feed(): """Feed the paper in by the height of one line, plus the line spacing, which should really be specified as a variable in the 'Initialize' MyBlock. """ motor['B'].on_for_degrees(-20, variables['Seg4']) motor['B'].on_for_degrees(-20, 20) def lower_pen(): """Lowers the pen on the page so that it will deposit ink when it is moved. """ motor['C'].on_for_degrees(25, -180)
Please do not give solution in image format thanku
convert this into pybricks :
from project import motor
from project import sensor
from project import variables
def feed_in():
"""This will feed the paper in until it covers the light sensor. This
should be done before printing anything.
"""
while True:
motor['B'].on(-50)
if sensor['4'].read_reflected() > 4:
break
motor['B'].off()
def feed_out():
"""Call when you are finished printing to feed the paper out."""
while True:
motor['B'].on(50)
if sensor['4'].read_reflected() < 2:
break
motor['B'].off()
motor['B'].on_for_degrees(50, 600)
def lift_pen():
"""Lifts the pen off the page so that it can be moved without depositing
ink.
"""
motor['C'].on_for_degrees(25, 180)
def line_feed():
"""Feed the paper in by the height of one line, plus the line spacing,
which should really be specified as a variable in the 'Initialize' MyBlock.
"""
motor['B'].on_for_degrees(-20, variables['Seg4'])
motor['B'].on_for_degrees(-20, 20)
def lower_pen():
"""Lowers the pen on the page so that it will deposit ink when it is moved.
"""
motor['C'].on_for_degrees(25, -180)
Step by step
Solved in 3 steps