# Adafruit's 32x32 RGB LED matrix panel

• digitalWrite executes right to left (least-significant bit first)

You're right about the /127, but it's not quite 127, it's `127.000060558` - and I believe that makes a difference. You could try it and see I guess...

There was a discussion elsewhere on here, but if you break the multiply down, you get:

``````x*0b100000010000001 =
x*0b100000000000000 +
x*0b000000010000000 +
x*0b000000000000001 =
x << 14 +
x << 7 +
x
``````

If you assume that the 3 bits you want are as follows:

``````x = R0000000G0000000B0000000
``````

Then when you do that multiply you get:

``````R0000000G0000000B000000000000000000000 +
0000000R0000000G0000000B00000000000000 +
00000000000000R0000000G0000000B0000000

= R000000RG00000RGB00000GB000000B0000000
``````

And then when you shift it down and & with 7 you get:

``````= R000000RG00000RGB & 7
= RGB
``````

Anyway, it's a bit of a nasty hack. Precalculating so as to avoid having to do that would be much better :)
{"ft_lang_label":"__label__en","ft_lang_prob":0.9274546,"math_prob":0.9980425,"size":1741,"snap":"2023-14-2023-23","text_gpt3_token_len":509,"char_repetition_ratio":0.15947035,"word_repetition_ratio":0.5347222,"special_character_ratio":0.37909248,"punctuation_ratio":0.1163522,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9911085,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-28T03:37:50Z\",\"WARC-Record-ID\":\"<urn:uuid:28b5d624-6dcd-48d1-b8ed-bc491fd8c521>\",\"Content-Length\":\"15324\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2613194c-33f2-4105-bbe5-e9785228ff73>\",\"WARC-Concurrent-To\":\"<urn:uuid:af11ba8c-5b37-49cc-8037-7f3132331eae>\",\"WARC-IP-Address\":\"93.93.135.13\",\"WARC-Target-URI\":\"https://forum.espruino.com/comments/16500/\",\"WARC-Payload-Digest\":\"sha1:3VMR7DK6H54CUF4VPF527Q6HIHB5FRTU\",\"WARC-Block-Digest\":\"sha1:X67TTW5762WIX2KFQ6LVVBD2V3RD4NVN\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224643462.13_warc_CC-MAIN-20230528015553-20230528045553-00384.warc.gz\"}"}