PROS LCD Code

When I run my code for my claw, the LCD line seems to have no effect, and I have no idea whats wrong.
Heres the code.

if(state == 1 ) {
     int k = 580; // Units to close Claw motor
     int l = 70; // Velocity to close Claw Motor
     motor_move_absolute(CLAW_PORT, k, l);
     motor_set_brake_mode(CLAW_PORT, E_MOTOR_BRAKE_HOLD);

     lcd_print(0, "CLAW VOLTAGE: %i", k);
   }

I don’t see a problem with the call to lcd_print as document here.

I’m assuming you did initialize the lcd since that is done by the default project.

What I would do to debug is:
I’d put an lcd_print before the if(state == 1 ) { to see if lcd_print works and the code is just not entering the if. This would be printing the value of state.
I’d try a different line number.
I’d try to test if lcd_print returns true or false by making the robot move forward for true and turn for false.

Since I’ve not actually used the lcd emulator I don’t know if it scrolls. I know that can be done with LVGL. So maybe line 0 is off the screen. BTW, I doubt this is the case.

If this does not help, more code would be needed for evaluation.

1 Like

I don’t think I initialized it first.