Hello,
so im using this code to control apa102 led strip
two switches connected to between pins 7 & 9, 8 & 10
when either or both of these switches are closed the change on
led strip takes about 5 seconds, and if switch1 is closed, then open and
switch 2 is closed it registers as both switches are closed for about 5 seconds
any idea what might be causing this behaviour please?
code is more less just glued together from various sources as this forum
stackoverflow and such. when i set pins 9 and 10 set as INPUT_PULLUP
it doesnt work at all. for testing purposes switches are currently replaced with
jumper cables betweeen above mentioned pins.
thank you for help.
P.S. its running on arduino nano, i had to use old bootloader to be able to upload it. If it helps
#include <hsv2rgb.h>
#include <fastspi.h>
#include <noise.h>
#include <FastLED.h>
#include <fastspi_dma.h>
#include <colorutils.h>
#include <controller.h>
#include <led_sysdefs.h>
#include <platforms.h>
#include <fastspi_types.h>
#include <fastled_config.h>
#include <pixelset.h>
#include <bitswap.h>
#include <fastspi_nop.h>
#include <lib8tion.h>
#include <fastled_progmem.h>
#include <cpp_compat.h>
#include <power_mgt.h>
#include <pixeltypes.h>
#include <color.h>
#include <fastpin.h>
#include <fastspi_ref.h>
#include <fastspi_bitbang.h>
#include <colorpalettes.h>
#include <fastled_delay.h>
#include <chipsets.h>
#include <FastLED.h>
//leds conf
#define DATA_PIN 12
#define CLOCK_PIN 11
#define NUM_LEDS 22
int buttonled1 = 9; // the number of the pushbutton p
int buttonled2 = 10;
CRGB leds[NUM_LEDS];
void setup()
{
FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT); // sets 2 digital pins 7 & 8 as output
pinMode(9, INPUT);
pinMode(10, INPUT);
digitalWrite(8, HIGH); // sets the digital pin 13 on
digitalWrite(7, HIGH);
}
void loop()
{
buttonled1 = digitalRead(9);
buttonled2 = digitalRead(10);
if (buttonled1 == HIGH && buttonled2 == HIGH) // black
{
LEDS.showColor(CRGB(255, 255, 255)); // off
}
if (buttonled1 == LOW && buttonled2 == HIGH) //red
{
LEDS.showColor(CRGB(255, 0, 0));
}
if (buttonled1 == HIGH && buttonled2 == LOW) //blue
{
LEDS.showColor(CRGB(0, 0, 255));
}
if (buttonled1 == LOW && buttonled2 == LOW) //white
{
LEDS.showColor(CRGB(0, 0, 0));
}
}