Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controlling 1 color LEDs? #3

Open
lain-d opened this issue Aug 18, 2018 · 2 comments
Open

controlling 1 color LEDs? #3

lain-d opened this issue Aug 18, 2018 · 2 comments

Comments

@lain-d
Copy link

lain-d commented Aug 18, 2018

Is it possible to use this library to control 1 color LEDs (1 per channel) instead of RGB Leds like in the example?

@swissbyte
Copy link

Yes, it is possible, as long as you modify the tlc5955.cpp file.

The follwing section contains the relevant code:

void TLC5955::setLed(uint16_t led_number, uint16_t rgb) { uint8_t chip = (uint16_t)floor(led_number / LEDS_PER_CHIP); uint8_t channel = (uint8_t)(led_number - LEDS_PER_CHIP * chip); // Turn that LED on _grayscale_data[chip][channel][2] = rgb; _grayscale_data[chip][channel][1] = rgb; _grayscale_data[chip][channel][0] = rgb; }

Basically you just need to write into the temp register directly, like this way (untested!)

void TLC5955::setLed(uint16_t led_number, uint8_t sub_channel, uint16_t PWM_Value) { uint8_t chip = (uint16_t)floor(led_number / LEDS_PER_CHIP); uint8_t channel = (uint8_t)(led_number - LEDS_PER_CHIP * chip); // Turn that LED on _grayscale_data[chip][channel][sub_channel] = PWM_Value; }

With the code above, you get the ability to use an additional parameter (sub_channel) to define which output you want to use.

@lain-d
Copy link
Author

lain-d commented Feb 17, 2020

That makes sense! thanks so much. I have a couple of these chips lying around somewhere. I'll try it out when i get a chance. The project (still not done) was to make a low cost standard LED "pinball style" DMD (which traditionally was a 2-bit plasma display, later revised to led dot matrix)

A DMD display:
https://virtuapin.net/index.php?main_page=product_info&cPath=6&products_id=231&zenid=aen254vof2hmnfo0v6h2iv5dt4

the resolution is usually 128x32....so I was thinking I could just use one chip but i need to figure out how to cycle through the 128 rows of LEDs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants