This project is a door light controller using the CH32 microcontroller. It includes functionalities for controlling an LED light based on a button press and ambient light conditions, with PWM dimming and deep sleep mode for power saving.
- LED light control with PWM dimming
- Ambient light detection using a photoresistor
- Button press to extend light duration
- Deep sleep mode for power saving
- CH32 microcontroller
- LED
- Photoresistor
- Button
- Power management components
- PlatformIO
- CH32V003 SDK
- GPIO and PWM libraries
-
Clone the repository:
git clone https://github.com/yourusername/DoorLight.git cd DoorLight -
Open the project in PlatformIO:
platformio init --board ch32v003
-
Build and upload the firmware:
platformio run --target upload
- Power on the device.
- The LED will turn on based on the ambient light conditions.
- Press the button to extend the light duration.
- The device will enter deep sleep mode when the light is off to save power.
main.c: The main application code, including initialization, light control, and deep sleep functions.
This project is licensed under the MIT License. See the LICENSE file for details.