Custom Brain Screen Assignment for Robotics Class

I have to make a custom brain screen for my class. keep in mind I am very new to coding in general and we are using python and I have a couple questions.

1: How do I do a callback so that if i have a rectangle, i can use brainscreen pressed/ing? (idk the difference) to make the brain print “color. pressed”

2: struggling with getting my rectangles to actually fit on the screen where they are all the same size. (print rectangle (x,x,x,x)

3: what does set cursor do? and what can it be used for

(I am the definition of explain it to a kindergartner)

I assume you are using vexcode text based on the context.

  1. the command pressed(callback) is used to call a different function.
    Say, for example, I want a function to spin a motor (for example)
    def motor_spin:
    motor.spin(forward)
    (This is pseudocode just to show what a function might look like)
    Then, you can use pressed(motor_spin) to execute the function in the brackets when the screen is pressed.
    The command pressing() returns 1 or 0 depending on whether it is pressed or not pressed. The typical use case is in an if statement, like if(brain.screen.pressing()):
    motor.spin(forward)
  2. For the rectangle, using the same number for all 4 parameters in the bracket won’t necesssarily work.

    If you want a square, just equate the last 2 and use the first 2 parameters to control the position.
  3. As you can see in the image below, the screen is broken up into pixels and when you are printing to the screen (writing text onto the screen), there has to be a starting point, hence the set cursor function, which sets the pixel to start the text from.
3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.