Need help trying to store a value into byte array buffer
I know I've been down this road before but I can't remember how it's supposed to work.
Pub Main | a, b, c
a := 400
b := 5
c := a / b ' Which is 80 decimal
Buffer := c ' Want to store the hex value of c here
I want to store the HEX value of c which should be 50 ($50 ?) in the Buffer at location 4 but I can't seem to get it through my head how to do it.
What are these variables such as a := 400? Is 400 a string, integer or decimal number? How do you convert it to a HEX value to be stored in my byte array Buffer?
Using the terminal if I send c using terminal.hex(c, 2) it will print 50. If I use terminal.dec(c) it will print 80.
If I manually use Buffer := $50 that works. I can read the Buffer and it shows 50
I know this should be such basic stuff but I am befuddled with this.
BTW I tried using [code] [/code] and it didn't format. I thought there used to be a Code button to insert code with but I don't see it.
Thanks. I feel stupid...