Day 9 - Let There Be Light

Day 9 - Let There Be Light

Hello #LinkedInCommunity! Antoine Gaton here, and I'm thrilled to bring you another exciting update from my 100 Days of Code challenge. Today, we're diving into the world of Arduino and light sensors, exploring how to harness the power of light to simulate battery charging. ????

?? The Quest for Knowledge Continues

As I embarked on Day 9, I was armed with curiosity and a handful of components. The mission? To create a program that monitors a light sensor (connected to pin A0) and leverages the sensor readings to determine the lighting conditions in a room. Depending on the detected light level, the Arduino would take various actions, including the possibility of shutting down under specific conditions.

???♂? Monitoring the Room's Lighting Conditions

The program began by reading the analog voltage from the light sensor and storing it in a variable. This sensor reading was then analyzed to determine the room's lighting conditions:

- If the room was bright, an onboard LED illuminated for a brief moment. If the brightness persisted, the program eventually decided it was "too bright" and initiated a controlled shutdown.

- If the room was dim, a different set of actions occurred. Again, if the dimness persisted, the program shut down the Arduino.

- If the room was dark, the program entered a similar cycle, ensuring that prolonged darkness led to a shutdown.

?? Simulating Battery Charging

In parallel, I explored another program that simulated charging a battery using the same light sensor. This code accumulated sensor readings as if they were charging the battery and calculated the battery's charge level as a percentage. This was a fascinating exploration into the world of monitoring and tracking energy levels.

?? Let's Connect!

Join me on this incredible coding journey, where each day brings new discoveries and fresh challenges. Your support, encouragement, and insights mean the world to me. Don't hesitate to share your thoughts, ideas, or even a friendly "hello" in the comments or via DM!

Stay Pushing,

Antoine

#100DaysOfCode #Arduino #LightSensor #BatteryCharging #LearningThroughCode

Brian Whipp

University of Texas at Austin Cybersecurity | CompTia Security +

1 年

Id like to take on some learning projects that involve hardware components as well. Very cool!

要查看或添加评论,请登录

Antoine Gaton的更多文章

社区洞察

其他会员也浏览了