Shop OBEX P1 Docs P2 Docs Learn Events
Print a hex value in VGA — Parallax Forums

Print a hex value in VGA

It seems that none of the VGA objects have a print hex method. I've tried putting one in from PST and several others but get weird numbers. What is the correct way to print a hex in VGA? I want to print time from a RTC
Thanks
Aaron

Comments

  • Use the hex method in the SimpleNumbers library object to convert the number to a hex string. Then print to VGA with the str method.

    (IMO, putting methods like hex and dec in every I/O object is a redundant waste of memory.)

    -Phil
  • avsa242avsa242 Posts: 452
    edited 2018-05-25 21:32
    Hi Aaron,

    You probably want the VGA_Text.spin object from the Propeller Tool library, or the equivalent display.vga.text.spin from https://github.com/parallaxinc/spin-standard-library, which both have hex methods.

    Usage:
    vga.hex (value, digits)
    


    Cheers,
    Jesse

    Edit: Doh! Too late...
  • Use the hex method in the SimpleNumbers library object to convert the number to a hex string. Then print to VGA with the str method.
    -Phil

    Thanks Phil that did it.
    Thanks to Jesse also.
    Aaron

Sign In or Register to comment.