You are reading a single comment by @d0773d and its replies.
Click here to read the full conversation.
-
@DrAzzy @allObjects thank you for the explanations
Sorry, I'm a bit dyslexic at times :) I meant to write 0b00000001
@DrAzzy @allObjects thank you for the explanations
Sorry, I'm a bit dyslexic at times :) I meant to write 0b00000001
The code below may give you what you are looking for. @DrAzzy explained you the decimal and apostrophe workings (but I'm not sure of your conclusion: To set the decimal point of the first/most left digit, I'd send 0b00000001).
Display pH 0...14.4 (theoretically up to 99.4) in 2 digits:
Display temperature 0...999.4### in 3 digits:
Since I do not have the display at hand, I can only test so far as creating the sting to send to it and look at it. In the attachment you find a .html file hat you can download anywhere on your hard drive, open with your browser, and enter value and see the string sent to the display. The .html includes the display pH and display temperature function and a interactive test bed around them (in another post I may add an emulation for the display.
For the calculation of the display value I tried to follow what I remembered from my stoichiometry / chemistry classes, where the teacher yelled at us to not consider the error calculation on reading scales, etc... and applied I reversely. You are the scientific judge to that... ;-)
For setting the decimal point - and for temperature the apostrophe for degree - I set the 6th (counting from 0) bit always to 1, which brings the character to send into the nicely printable range of either '@ABCD' and '`abcd', respectively.
If you want to set 'crazy' characters, you have to make a mapping from a character not used otherwise to a binary value. You achieve this by setting up a lookup string for getting an index, and with the index you go and get the binary value. It looks something like that:
The following code will return turn all segments of the first digit on:
You would use the lookup() function to create the string before sending it. Since the module can display all digits and the letters F, P, and H (and more), only for crazy patterns a lookup/mapping is required.