Thanyasit / Light_Control_With_Color

This code allows you to control a light using a photoresistor and a button, and also displays different colors on a NeoPixel strip based on the light level

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Light Control With Color

Description

This code allows you to control a light using a photoresistor and a button, and also displays different colors on a NeoPixel strip based on the light level. The light is turned on and off using a relay, and the color of the NeoPixel strip is determined by the light level detected by the photoresistor.
2020

Getting Started

To get started with this code, you will need the following components:

  • An Arduino board
  • A photoresistor
  • A 10k ohm resistor
  • A button
  • A relay
  • A NeoPixel strip
  • Jumper wires

Installation

1. Connect the photoresistor to analog pin A0 on the Arduino board, and connect the 10k ohm resistor from the same pin to ground.
2. Connect the button to digital pin 2 on the Arduino board, and use the internal pull-up resistor.
3. Connect the relay to digital pin 6 on the Arduino board.
4. Connect the NeoPixel strip to digital pin 8 on the Arduino board.
5. Upload the code to the Arduino board using the Arduino IDE or any other IDE that supports the Arduino board.

Usage

When you press the button, the light will turn on or off depending on its current state. The NeoPixel strip will display different colors based on the light level detected by the photoresistor. If the light level is high enough, the relay will turn on and the light will be on. If the light level is too low, the relay will turn off and the light will be off.

Example

License

This code is licensed under the MIT License. See the LICENSE file for details.

About

This code allows you to control a light using a photoresistor and a button, and also displays different colors on a NeoPixel strip based on the light level

License:MIT License


Languages

Language:C++ 100.0%