First post on the forum so I do hope this is the right place to ask my question.
I am trying to convert a Processing script from Adafruit into PHP. The sketch converts images into an image data array that can be used by an Arduino + thermal printer.
Most of this sketch is pretty simple to convert, but I am a bit stuck with the loop "for(b=128; b>=lastBit; b >>= 1)" and the output format "output.format("0x%02X", sum)".
My limited brain power means that I can't quite get my PHP script to give me the desired output. I hoping someone out there can give me a little guidance. Happy to share my PHP code so far if that is of any help?