how to add sensor with this type of code ?
//this code wanted attach ldr sensor act switch if ldr sensor detected rgb led strip program run if not detected nothing happen ..how add switch or sensor in code ?
//hope can me .. thank you
#include <fastspi_led.h>
#define num_leds 60
// chipsets wire in backwards sort of way
struct crgb { unsigned char b; unsigned char r; unsigned char g; };
// struct crgb { unsigned char r; unsigned char g; unsigned char b; };
struct crgb *leds;
#define pin 11
void setup()
{
fastspi_led.setleds(num_leds);
fastspi_led.setchipset(cfastspi_led::spi_lpd6803);
fastspi_led.setpin(pin);
fastspi_led.init();
fastspi_led.start();
leds = (struct crgb*)fastspi_led.getrgbdata();
}
void loop() {
for(int j = 0; j < 3; j++) {
for(int = 0 ; < num_leds; i++ ) {
memset(leds, 0, num_leds * 3);
switch(j) {
case 0: leds.r = 255; break;
case 1: leds.g = 255; break;
case 2: leds.b = 255; break;
}
fastspi_led.show();
delay(50);
}
}
}
//hope can me .. thank you
#include <fastspi_led.h>
#define num_leds 60
// chipsets wire in backwards sort of way
struct crgb { unsigned char b; unsigned char r; unsigned char g; };
// struct crgb { unsigned char r; unsigned char g; unsigned char b; };
struct crgb *leds;
#define pin 11
void setup()
{
fastspi_led.setleds(num_leds);
fastspi_led.setchipset(cfastspi_led::spi_lpd6803);
fastspi_led.setpin(pin);
fastspi_led.init();
fastspi_led.start();
leds = (struct crgb*)fastspi_led.getrgbdata();
}
void loop() {
for(int j = 0; j < 3; j++) {
for(int = 0 ; < num_leds; i++ ) {
memset(leds, 0, num_leds * 3);
switch(j) {
case 0: leds.r = 255; break;
case 1: leds.g = 255; break;
case 2: leds.b = 255; break;
}
fastspi_led.show();
delay(50);
}
}
}
Arduino Forum > Using Arduino > Programming Questions > how to add sensor with this type of code ?
arduino
Comments
Post a Comment