TLC 5940 and pushbutton control
hi! i'm trying hard control individual leds hooked tlc 5940.
1. use push button turn led on , off (i can of course regular sketch using solution (from book), i'd access individual led controls within tlc 5940:
if (val == high) {
digitalwrite(led, 1);
}else{
digitalwrite(led, low);
2. keep line of 16 leds running 1 (or more leds) on - each controlled own push button.
here's sketch far, , - i've taken out parts don't work, line of leds works way i'd to, , i've added dial potentiometer control speed of leds.
1. use push button turn led on , off (i can of course regular sketch using solution (from book), i'd access individual led controls within tlc 5940:
if (val == high) {
digitalwrite(led, 1);
}else{
digitalwrite(led, low);
2. keep line of 16 leds running 1 (or more leds) on - each controlled own push button.
here's sketch far, , - i've taken out parts don't work, line of leds works way i'd to, , i've added dial potentiometer control speed of leds.
code: [select]
#include "tlc5940.h"
#define analog_pin1 1
#define button 2
#define led 7
int val = 0; //me
int val2 = 0; //me
void setup()
{
tlc.init();
pinmode(button, input);
pinmode(led, output);
}
void loop()
{
for (int channel = 0; channel < num_tlcs * 16; channel += 1)
{
int direction = 1;
tlc.clear();
tlc.set(channel, 25); //mr- changed (channel, 0) value 1000 0 stop gradual fade light light.
tlc.update();
delay(analogread(analog_pin1)); //me
// val = digitalread(button);
val2 = digitalread(button);
// if (val == high) {
// digitalwrite(led, 1);
// }else{
// digitalwrite(led, low);
// }
// if (val2 == high) { //me
// digitalwrite(channel = 4, 25); //me
// } else { //me
// digitalwrite(channel = 4, 0); //me
// }
}
}
Arduino Forum > Using Arduino > LEDs and Multiplexing > TLC 5940 and pushbutton control
arduino
Comments
Post a Comment