cbc_printf formatting in CBC v2 display

2 replies [Last post]
Title: NooBot
Joined: 05/06/2012
BotPoints: 6
User offline. Last seen 10 years 18 weeks ago.

the cbc_printf() function seems to scroll the display of the CBC. Is there a way to better control the function for neat output to the screen? The following simple example works but causes the display to scroll, the display will 'fix its self' each iteration but not neat. Also after several passes through the loop, the cbc_printf() seems to output an additional new line that scrolls the screen. Thx!

  1. int main()
  2. {
  3. int i = 0;
  5. cbc_display_clear();
  6. cbc_printf(2, 1, "Title Here 0123456789");
  7. while (1 == 1)
  8. {
  9. i++;
  11. cbc_printf(2, 5, "i=%d", i);
  12. cbc_printf(2, 3, "time %f", seconds());
  13. sleep(5.0);
  14. }
  15. return 0;
  16. }

Beta's picture
Title: The Magnificent
Joined: 02/24/2012
BotPoints: 266
User offline. Last seen 8 years 32 weeks ago.

Unfortunately, due to the way the "console" is implemented in cbcui, it isn't possible to clear. The "clearing" done right now is kind of a hack, as you've noticed. I don't think there is a function that gives you more control than cbc_printf. There are ways to start a program over ssh, which would give you correct output on a remote terminal, since ssh is a full blown terminal emulator, but that is beyond the scope of what KIPR supports.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

I imagine it shouldn't be too hard for a hacker to add this functionality. Anyone want to become the 6th Botball hacker (after Jorge, me, Farz, Matt, and Braden)?

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS