Skip to content

Instantly share code, notes, and snippets.

@EDISON-SCIENCE-CORNER
Created November 1, 2021 09:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EDISON-SCIENCE-CORNER/124c39bd58dff246c49115739daab49e to your computer and use it in GitHub Desktop.
Save EDISON-SCIENCE-CORNER/124c39bd58dff246c49115739daab49e to your computer and use it in GitHub Desktop.
#include <FastLED.h>
#define NUM_LEDS 2
#define DATA_PIN 6
#define CLOCK_PIN 13
CRGB leds[NUM_LEDS];
void setup() {
pinMode (3,INPUT);
pinMode (2,OUTPUT);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
int x=digitalRead(3);
if (x==0)
{
digitalWrite(2,LOW);
leds[0] = CRGB::Red;
FastLED.show();
delay(500);
leds[1] = CRGB::Red;
FastLED.show();
delay(500);
leds[0] = CRGB::Black;
FastLED.show();
delay(500);
leds[1] = CRGB::Black;
FastLED.show();
delay(500);
}
else
{
digitalWrite(2,HIGH);}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment