Error on code line that looks fine

I am getting the error:

Program running, receiving output...

Adding image: main
Program size 5 kb.

Compile done. Time: 1289 ms

Listening for output...

Download done. Time: 1576 ms

Debugger engine started.
EXCEPTION: 0xEA Name error
__FILE_ID__ 0x09 / Line 1756
[File "main", line 172, in drivercontrol
](chrome-extension://ablgfcdjafdflgnbbbffcdginlaoembf/project.html?id=1#)INPUT ERROR: BytesToRead: ClearCommError failed

image

on this line of code:
Tilt.stop(vex.BrakeType.COAST). and when I comment out the line of code, the error moves to the next line of code.

Our full code

β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘Robotics β–’β–’β–’β–’β–‘β–‘β–‘β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ Is The β–’β–’β–’β–’β–’β–‘β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ Best β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–‘β–’β–’β–’β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–’β–’β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–’β–’β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–’β–’β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–’β–‘β–‘β–‘β–‘β–‘β–‘β–“β–“

β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“

_______β–’__________β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’

______β–’_______________β–’β–’β–’β–’β–’β–’β–’β–’

_____β–’________________β–’β–’β–’β–’β–’β–’β–’β–’

____β–’___________β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’

___β–’

__β–’______β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“

_β–’______β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“

β–’β–’β–’β–’___β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“

β–’β–’β–’β–’__β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“β–’β–“

β–’β–’β–’__β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“

β–’β–’

VEX V5 Python Project with Competition Template

import sys
import vex
from vex import *

#region config
brain = vex.Brain()
Right_Front = vex.Motor(vex.Ports.PORT11, vex.GearSetting.RATIO18_1, True)
Right_Back = vex.Motor(vex.Ports.PORT12, vex.GearSetting.RATIO18_1, True)
Left_Front = vex.Motor(vex.Ports.PORT1, vex.GearSetting.RATIO18_1, False)
Left_Back = vex.Motor(vex.Ports.PORT2, vex.GearSetting.RATIO18_1, False)
#Tilt = vex.Motor(vex.Ports.PORT7, vex.GearSetting.RATIO36_1, False)
#Intake_Left = vex.Motor(vex.Ports.PORT10, vex.GearSetting.RATIO18_1, True)
#Intake_Right = vex.Motor(vex.Ports.PORT20, vex.GearSetting.RATIO18_1, False)
Arms = vex.Motor(vex.Ports.PORT19, vex.GearSetting.RATIO18_1, False)

Autton_1 = vex.Limit(brain.three_wire_port.a)

Autton_2 = vex.Limit(brain.three_wire_port.b)

Autton_3 = vex.Limit(brain.three_wire_port.c)

Autton_4 = vex.Limit(brain.three_wire_port.d)

Autton_5 = vex.Limit(brain.three_wire_port.e)

Autton_6 = vex.Limit(brain.three_wire_port.f)

Autton_7 = vex.Limit(brain.three_wire_port.g)

Autton_8 = vex.Limit(brain.three_wire_port.h)

con = vex.Controller(vex.ControllerType.PRIMARY)
#endregion config

Right = None
Left = None
Drive_Speed = None
Speed = None

def Drive(Right, Left, Drive_Speed):
Right_Front.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Right_Back.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Left_Front.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Left_Back.set_velocity(Drive_Speed, vex.VelocityUnits.PCT)
Right_Front.start_rotate_for(vex.DirectionType.FWD, Right, vex.RotationUnits.REV)
Right_Back.start_rotate_for(vex.DirectionType.FWD, Right, vex.RotationUnits.REV)
Left_Front.start_rotate_for(vex.DirectionType.FWD, Left, vex.RotationUnits.REV)
Left_Back.rotate_for(vex.DirectionType.FWD, Left, vex.RotationUnits.REV)

def Turn_Intake(Speed):
Intake_Left.spin(vex.DirectionType.FWD, Speed, vex.VelocityUnits.PCT)
Intake_Right.spin(vex.DirectionType.FWD, Speed, vex.VelocityUnits.PCT)

Creates a competition object that allows access to Competition methods.

competition = vex.Competition()

def pre_auton():
# All activities that occur before competition start
# Example: setting initial positions
pass

Autton_5 is Red Procted

Autton_6 is Red UnProcted

Autton_7 is Blue Procted

Autton_8 is Blue UnProcted

def autonomous():
if Autton_5.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_6.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_7.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_8.pressing():
Drive(1, 1, 50)
Drive(-1, -1, 50)
elif Autton_1.pressing():
# Turn_Intake(None)

Drive(None, None, None)

Turn_Intake(None)

Drive(None, None, None)

Drive(None, None, None)

sys.sleep(1)

Drive(None, None, None)

Drive(None, None, None)

Drive(None, None, None)

Turn_Intake(None)

Drive(None, None, None)

Drive(None, None, None)

Drive(None, None, None)

brain.screen.print_line(1, 'No Jumper in Programed Port!')
con.screen.set_cursor(1, 1)
con.screen.print_('No Jumper in Programed Port!')

elif Autton_2.pressing():
brain.screen.print_line(1, β€˜No Jumper in Programed Port!’)
con.screen.set_cursor(1, 1)
con.screen.print_(β€˜No Jumper in Programed Port!’)
elif Autton_3.pressing():
brain.screen.print_line(1, β€˜No Jumper in Programed Port!’)
con.screen.set_cursor(1, 1)
con.screen.print_(β€˜No Jumper in Programed Port!’)
elif Autton_4.pressing():
brain.screen.print_line(1, β€˜No Jumper in Programed Port!’)
con.screen.set_cursor(1, 1)
con.screen.print_(β€˜No Jumper in Programed Port!’)
else:
brain.screen.print_line(1, β€˜No Jumper In The Robot!’)
con.screen.set_cursor(1, 1)
con.screen.print_(β€˜No Jumper!’)
pass
pass

def drivercontrol():
# Place drive control code here, inside the loop

# This code will run onece:
Intake = 0


while True:
    # This code will repete
    # This is the main loop for the driver control.

    
    # Drive the robot using tank drive

    con.set_deadband(10, vex.PercentUnits.PCT)
    # Right_Front.spin(vex.DirectionType.FWD, (con.axis2.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
    # Right_Back.spin(vex.DirectionType.FWD, (con.axis2.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
    # Left_Front.spin(vex.DirectionType.FWD, (con.axis3.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
    # Left_Back.spin(vex.DirectionType.FWD, (con.axis3.position(vex.PercentUnits.PCT)*0.65), vex.VelocityUnits.PCT)
    Right_Front.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
    Left_Front.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
    Right_Back.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
    Left_Back.spin(vex.DirectionType.FWD, ((con.axis2.position(vex.PercentUnits.PCT)/100)**3)*100, vex.VelocityUnits.PCT)
    # Move the tilt tray if the buttons get pushed
    if con.buttonA.pressing():
         Tilt.spin(vex.DirectionType.FWD, 30, vex.VelocityUnits.PCT)
    elif con.buttonB.pressing():
         Tilt.spin(vex.DirectionType.REV, 30, vex.VelocityUnits.PCT)
    else:

         Tilt.stop(vex.BrakeType.COAST)
         Tilt.spin(vex.DirectionType.REV, 0, vex.VelocityUnits.PCT)
         Tilt.stop
    #Spin the intake if the burrons are pushed
    if con.Left.pressing():
         Intake_Left.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
         
    elif con.Down.pressing():
         Intake_Left.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
         
    else:
         Intake_Left.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
         
         
    if con.Up.pressing():
         
         Intake_Right.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
    elif con.Right.pressing():
         
         Intake_Right.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
    else:
         
         Intake_Right.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
    
    if con.R1.pressing():
         Arms.spin(vex.DirectionType.FWD, 30, vex.VelocityUnits.PCT)
    elif con.R2.pressing():
         Arms.spin(vex.DirectionType.REV, 30, vex.VelocityUnits.PCT)
    else:
         Arms.stop(vex.BrakeType.COAST)
         Arms.spin(vex.DirectionType.REV, 0, vex.VelocityUnits.PCT)
         Arms.stop
         
    if con.L1.pressing():
         Intake_Left.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
         Intake_Right.spin(vex.DirectionType.FWD, 100, vex.VelocityUnits.RPM)
    elif con.L2.pressing():
         Intake_Left.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
         Intake_Right.spin(vex.DirectionType.REV, 100, vex.VelocityUnits.RPM)
    else:
         Intake_Left.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
         Intake_Right.spin(vex.DirectionType.FWD, 0, vex.VelocityUnits.RPM)
         
    sys.sleep(0.2)
pass

Do not adjust the lines below

Set up (but don’t start) callbacks for autonomous and driver control periods.

competition.autonomous(autonomous)
competition.drivercontrol(drivercontrol)

Run the pre-autonomous function.

pre_auton()

Robot Mesh Studio runtime continues to run until all threads and

competition callbacks are finished.

Thanks in advance for your help!

You’re referencing the Tilt motor but you commented its declaration out by hand in the automatic config region. The error moves to the next like because the next line also references the Tilt motor that doesn’t exist.

Thank you so much :slight_smile:

(BTW: I used @GreatACPO’s computer at school, so the original post came from there)

@John_TYler, you are a huge help, along with the others at @RobotMesh! Thank you so much!

On a side note, how will I use vex.Bitmap and vex.BrainLcd to display an image on the brain? I found some threads that explain it in C++, but not in python! Any help will be thanked! Thanks in advance?

(also, should I move this question to a new thread?)

Any help would be appreciated :smile:

Should be just:

my_png_img = vex.Bitmap.from_png_file("my_filename.png")
brain.screen.draw_bitmap(my_png_img)

See:
Bitmap class
BrainLcd class

1 Like

Thank you! I looked at those previously, and it drive much head in circles. Do I have to save the file to a SD card, and put it in the brain, or can I somehow keep the file on the brain?

SD card, yes.

Ok… How do I format the SD card?

…is your SD card not working with the Brain?

I never tested, but I read in a lot of threads, your SD card needs to be formatted… I am wondering how to do this. [Btw, my operating system on my laptop is windows 10.]