diff --git a/ESP8266/Basic RGB LED Blinking Using ESP8266/Basic RGB LED Blinking Using ESSP8266/Basic_RGB LED_Blinking_Using_ESP8266.ino b/ESP8266/Basic RGB LED Blinking Using ESP8266/Basic RGB LED Blinking Using ESSP8266/Basic_RGB LED_Blinking_Using_ESP8266.ino new file mode 100644 index 00000000..4e7a5522 --- /dev/null +++ b/ESP8266/Basic RGB LED Blinking Using ESP8266/Basic RGB LED Blinking Using ESSP8266/Basic_RGB LED_Blinking_Using_ESP8266.ino @@ -0,0 +1,35 @@ +#include + +#define PIN_R 1 // Replace with the GPIO pin for the Red LED +#define PIN_G 2 // Replace with the GPIO pin for the Green LED +#define PIN_B 3 // Replace with the GPIO pin for the Blue LED +#define NUM_LEDS 1 + +Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN_R, NEO_GRB + NEO_KHZ800); + +void setup() { + strip.begin(); + strip.show(); +} + +void loop() { + // Turn on Red LED + colorWipe(strip.Color(255, 0, 0), 50); // Red + delay(500); + + // Turn on Green LED + colorWipe(strip.Color(0, 255, 0), 50); // Green + delay(500); + + // Turn on Blue LED + colorWipe(strip.Color(0, 0, 255), 50); // Blue + delay(500); +} + +void colorWipe(uint32_t color, int wait) { + for(int i=0; iMukund Solanki \ No newline at end of file diff --git a/Raspberry Pi/Blink_The_LED/blink_led.py b/Raspberry Pi/Blink_The_LED/blink_led.py new file mode 100644 index 00000000..4a9ea11d --- /dev/null +++ b/Raspberry Pi/Blink_The_LED/blink_led.py @@ -0,0 +1,24 @@ +import time +from gpiozero import LED + +# Set the GPIO pin according to your setup +led = LED(17) + +def blink_led(interval_seconds, duration_seconds): + start_time = time.time() + end_time = start_time + duration_seconds + + while time.time() < end_time: + led.on() + time.sleep(interval_seconds / 2) + led.off() + time.sleep(interval_seconds / 2) + +if __name__ == "__main__": + # Set the interval and duration + blink_interval = 2 # seconds + blink_duration = 10 # seconds + + print(f"Blinking LED every {blink_interval} seconds for {blink_duration} seconds") + + blink_led(blink_interval, blink_duration) diff --git a/Raspberry Pi/Blink_The_LED/requirements.py b/Raspberry Pi/Blink_The_LED/requirements.py new file mode 100644 index 00000000..0a7ddfba --- /dev/null +++ b/Raspberry Pi/Blink_The_LED/requirements.py @@ -0,0 +1,4 @@ +1) Rasberry-Pi +2) Bread-Board +3) Jumper-Wires +4) LED \ No newline at end of file