Skip to content

Commit

Permalink
Added basic ADC implementation. The ADC is is init and calibrated. AD…
Browse files Browse the repository at this point in the history
…C Read impl remaining.

Completed ADC Read method implementation

Changed ADC Bitwidth to 12, and removed extra config files while adding
gitignore rules for them.

Updated LSA example
  • Loading branch information
SuperChamp234 committed Jan 30, 2024
1 parent 6b3dc21 commit e9bf1a7
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 1,205 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
### C ###
# SDK Config files
sdkconfig

# Build folder
build/

Expand Down
13 changes: 5 additions & 8 deletions examples/lsa/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ static const char* TAG = "LSA_READINGS";
void app_main(void)
{
// enable line sensor
ESP_ERROR_CHECK(enable_line_sensor());

//Union containing line sensor readings
adc_handle_t adc_handle;
ESP_ERROR_CHECK(enable_line_sensor(&adc_handle));
line_sensor_array line_sensor_readings;

while(1)
while (1)
{
// get line sensor readings
line_sensor_readings = read_line_sensor();
line_sensor_readings = read_line_sensor(adc_handle);
for(int i = 0; i < 5; i++)
{
// constrain lsa readings between BLACK_MARGIN and WHITE_MARGIN
Expand All @@ -58,6 +56,5 @@ void app_main(void)

// log final lsa readings
ESP_LOGI(TAG, "LSA_0: %d \t LSA_1: %d \t LSA_2: %d \t LSA_3: %d \t LSA_4: %d",line_sensor_readings.adc_reading[0], line_sensor_readings.adc_reading[1], line_sensor_readings.adc_reading[2], line_sensor_readings.adc_reading[3], line_sensor_readings.adc_reading[4]);

}
}
}
Loading

0 comments on commit e9bf1a7

Please sign in to comment.