Controller Print not working

when i put this code into my drive code it immediately kicks me out as soon as i start it any suggestions, code is below we are using python

con.screen.set_cursor(1, 1)
con.screen.set_cursor(2, 1)

Did you declare your controller as con?

@RoboKnight yes, that is what it is defined as.

Any chance you can set your project to public (under the Options gear at the top right) and provide a link to it?


Your indentation is wrong. Python cares about formatting. Lines 63-99 (excepting lines 70-73) aren’t indented far enough to be part of the while True: on line 62.

The reason the error shows up when you put the controller printing stuff in is lines 70-73 are indented properly, so there is no syntax error until you add them. With or without them you have a logic error because lines 76-99 aren’t indented to be part of the while on line 62. Additionally, you will find that there’s an additional logic error in calling two controller prints back-to-back, as the controller ignores messages for 50ms after receiving a message.

The easy way to indent several lines at once is to select all of them then hit the Tab key. It will indent all lines with highlighted text (as long as parts of more than one line are selected). The same can be done for undoing an indent, but with Shift+Tab instead of Tab.

@John_TYler But even when it is spaced correctly it still kicks me right out of the code

Looking at it right now, the spacing is not correct. You made lines 70-73, which were correct, match the rest of lines 63-99, which were incorrect. You made the wrong fix.

My middle school team is having an issue where they are using a potentiometer to select the autonomous. They are wanting to print to the controller which auton is selected.

It is sort of working. The problem is that it only flashes the value and quickly disappears. Is there a way to get what is printed to the screen to stay there?

Yes. I’d have to see the code to know exactly what you’re doing wrong, though. If you set your project to public through the Options gear at the top right and paste a link to the project here I’ll take a look at it.

1 Like


You’re trying to print to the controller’s screen too quickly. It will ignore messages that are sent more often than once every 50ms.

That being said, I can’t see any reason why it would flash quickly and disappear. I can see some reasons why it might not work at all when the pot was between 456 and 3460, but that shouldn’t cause a brief flash then blankness like you reported.

Try fixing the lack-of-delay problem first and see where that gets you.