I am using pros::screen::draw_pixel to draw on the brain screen, but when I run the code, the brain draws it correctly, then the screen immediately turns gray. If I constantly draw it in the control loop, then it lags the opcontrol (it is a lot of drawpixels). Do you have any idea how to fix this? Thank you!
Actually, I was able to make it work using threads, but I would also appreciate it if someone could explain why the gray screen happens. Thank you!
Could you send a copy of your code?
Bit hard to help debug without it.
1 Like
for (int x = 0; x >= 0; x++){
for (int y = 0; y < 272; y++){
if (data[x + (480 * y)] == '0'){
pros::screen::set_pen(COLOR_BLACK);
}else if (data[x + (479 * y)] == '1'){
pros::screen::set_pen(COLOR_WHITE);
}
pros::screen::draw_pixel(x, y);
}
}
(data is the string of 0s and ones that I want to print but it’s too large to show here)
This is an issue, fix that and see what happens.
and you also have different offsets into the data array
1 Like
Oh sorry, I sent the wrong code. It is supposed to be x < 480
, also I changed it to (480 * y)
(that was also a mistake) and it still has that problem.