Sensor reading through ADC (temperature, light)
📖 Scenario: You are working on a small embedded system that reads sensor values from two sensors: a temperature sensor and a light sensor. Both sensors send analog signals to the microcontroller's ADC (Analog to Digital Converter). Your task is to write a simple program that reads these ADC values and stores them for further processing.
🎯 Goal: Build a program that initializes two variables to hold ADC readings from temperature and light sensors, sets a maximum ADC value for reference, reads the ADC values using a loop, and then prints the results.
📋 What You'll Learn
Create two integer variables named
temp_adc and light_adc to store ADC readings.Create an integer variable named
max_adc_value and set it to 1023 (10-bit ADC max).Use a
for loop with variable i to simulate reading ADC values for both sensors.Print the ADC values of
temp_adc and light_adc.💡 Why This Matters
🌍 Real World
Reading sensor values through ADC is common in embedded systems like weather stations, smart home devices, and robotics.
💼 Career
Embedded developers often write code to read and process sensor data using ADCs to build responsive and accurate hardware systems.
Progress0 / 4 steps