# Adafruit 16x24 red LED matrix (HT1632)

**URL:** <https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999>\
**Category:** Troubleshooting\
**Created:** [July 4, 2015, 11:48pm UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999 "2015-07-04T23:48:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Proto](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@Proto](https://community.particle.io/u/Proto)\
**Post date:** [July 4, 2015, 11:48pm UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/1 "2015-07-04T23:48:33Z")

</div>

I was trying to use the 16x24 LED matrix from Adafruit with the Particle Photon. I tried uploading the default example from the Adafruit and I can’t seem to get the display to work even though the example seems to upload fine with no errors. The display works fine on my Arduino UNO. Does anyone know what steps I would need to get this library working? The link to the library is below:

> **[adafruit/HT1632](https://github.com/adafruit/HT1632)**
>
> Arduino library code for HT1632(C) matrix panel driver chips, and the panels we have in the Adafruit shop

Any help or tips on what I should do next would be appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![Jack](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jack/32/5412_2.png) [@Jack](https://community.particle.io/u/Jack)\
**Post date:** [July 5, 2015, 12:27am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/2 "2015-07-05T00:27:49Z")

</div>

1. Is your code being flashed (D7 indicating, or other way to tell)? See [How to get started?](https://community.particle.io/t/how-to-get-started/12953/10)
2. Could it be 3.3V out of Photon, is a bit shy for a 5V input?
3. What does " I can’t seem to get the display to work" mean? Wrong characters, no lights, ?

---

<div class="post-metadata">

**Author:** ![Proto](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@Proto](https://community.particle.io/u/Proto)\
**Post date:** [July 5, 2015, 1:15am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/3 "2015-07-05T01:15:44Z")

</div>

Hi Jack. The answers to your questions are below:

1. I confirmed that the code was in fact not being flashed when I was trying to upload it in Particle Dev. It was apparently running some old code that I previously loaded and I didn’t see any errors so I just assumed everything was working.
2. I am using a seperate 5v source to power both the Photon via the VIN pin and also the LED Matrix so I don’t believe that is the issue.
3. The display does not light up at all and does not appear to turn on.

I am able to flash other programs to the Photon now and when I attempted to load the basic example from the Adafruit library I now get the following error:

avr/io.h: No such file or directory

I’m not sure where to go from here or if this issue is just because the library I am using is not compatible.

---

<div class="post-metadata">

**Author:** ![Jack](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jack/32/5412_2.png) [@Jack](https://community.particle.io/u/Jack)\
**Post date:** [July 5, 2015, 1:36am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/4 "2015-07-05T01:36:39Z")

</div>

@Proto, thanks for the detailed information. I am not familiar with that library. Maybe one of the guys that is, will have a suggestion (long weekend tho).

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [July 5, 2015, 2:04am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/5 "2015-07-05T02:04:16Z")

</div>

@Proto:

1. In file HT1632.h, there are a couple of `#if(ARDUINO >= 100)` conditional compile statements. How did you modify these for the Photon?

2. If you are using the basicdemo.pde demo code, did you rename it to basicdemo.ino? What did you assign to these values:

```auto
 #define DATA 2
 #define WR 3
 #define CS 4

```

---

<div class="post-metadata">

**Author:** ![Proto](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@Proto](https://community.particle.io/u/Proto)\
**Post date:** [July 5, 2015, 5:02am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/6 "2015-07-05T05:02:34Z")

</div>

I just received the photon a few days ago so this is all new to me. I have limited experience with creating libraries and I’ve also have never tried to port one over to work with the photon before so I don’t know if I’ll be able to figure it out. To answer your questions:

1. I commented out the #if(ARDUINO \>= 100) and replaced it with #include “application.h”. I’m not sure if this is all I need to do here.
2. I was attempting to use the basic demo.pde so I renamed the sketch as ht1632test.ino and placed it in a folder called ht1632test with the HT1632.cpp, HT1632.h and glcdfont.c files. (I can attempt to compile the code but I just encounter several different errors). I have not yet changed the values for DATA, WR and CS.

Upon more review, I noticed that this library has several bits of code that are AVR specific some of which I listed below:

–glcdfont.c  
avr/io.h and avr/pgmspace.h with PROGMEM macro which would not be applicable for the photon

–HT1632.cpp  
\_\_BV macro

I’m not sure what the next step is but I’m sure I would have to update all of these. I am going to take another look tomorrow. Thanks so far for the help!

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [July 5, 2015, 5:27am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/7 "2015-07-05T05:27:03Z")

</div>

@Proto, some very basic pointers for porting Arduino libraries can be found here  
[https://github.com/harrisonhjones/Spark-Ported-Libraries](https://github.com/harrisonhjones/Spark-Ported-Libraries)

But at the moment it’s still solely focused on the Particle Core and not the Photon, you’ll get some idea tho’.  
The conditional compiling directive for the Photon would be `#if (PLATFORM_ID == 6)` instead of `#if defined(SPARK)` (for the Core it’s now `PLATFORM_ID == 0`).

* * *

After having a look at the lib I’m convinced you can manage to port the lib with only the hints from the link above. There is no bare metal programming that would need some major rework of the original code.  
But if you should still happen to have problems getting the hang of it, just ask, we’re there to help, when we see your effort.  
Any error messages you get after porting would be good to post too.

* * *

One bit missing in the link above:

```auto
#define _BV(x) (1 << x) 

```

* * *

Since you haven’t changed the pin assignment, how have you wired the display?  
Although it’s discouraged to use the “number-only” pin referencing on Particle devices (rather use the labels printed on the board) it’ll still work when you wire up `D2`, `D3`, `D4`.

---

<div class="post-metadata">

**Author:** ![Proto](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@Proto](https://community.particle.io/u/Proto)\
**Post date:** [July 5, 2015, 4:00pm UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/8 "2015-07-05T16:00:03Z")

</div>

Thanks very much! That link was super helpful. I was just able to get the test program to work and everything looks good. I also ran the other two examples in the library and they are both working. This is great!

---

<div class="post-metadata">

**Author:** ![Arne](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Arne](https://community.particle.io/u/Arne)\
**Post date:** [January 12, 2020, 11:30am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/9 "2020-01-12T11:30:08Z")

</div>

> [@peekay123](#):
>
> HT1632.

Does anyone has some working code for the Photon here?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [January 13, 2020, 1:35am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/10 "2020-01-13T01:35:22Z")

</div>

@Arne, give this Web IDE app a shot. I used the matrix demo code in this case. I don’t have an HT1632 to test with so you will need to do that.

[https://go.particle.io/shared\_apps/5e1bc837ab86a600051a962a](https://go.particle.io/shared_apps/5e1bc837ab86a600051a962a)

Note the following pin assignment which you will need to follow:

```auto
#define HT_DATA D2
#define HT_WR D3
#define HT_CS D4
#define HT_CS2 D5

```

Let me know how it goes!

---

<div class="post-metadata">

**Author:** ![Arne](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Arne](https://community.particle.io/u/Arne)\
**Post date:** [January 14, 2020, 7:42am UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/11 "2020-01-14T07:42:21Z")

</div>

> [@peekay123](#):
>
> to test with so you will need to do t

It was actually very easy when I got the pins right 😃

should the library be availeble in the online editor?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [January 14, 2020, 1:14pm UTC](https://community.particle.io/t/adafruit-16x24-red-led-matrix-ht1632/12999/12 "2020-01-14T13:14:33Z")

</div>

@Arne, glad to see it works! Now that I know it works, I can create a library for publishing on the Particle Web IDE, possibly this weekend. 😄
