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 16, 2024
1 parent f1865c8 commit 6bcd937
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 2,325 deletions.
13 changes: 8 additions & 5 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 Expand Up @@ -76,8 +79,8 @@ dkms.conf

### vscode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
.vscode/settings.json
.vscode/tasks.json
.vscode/launch.json
.vscode/extensions.json
*.code-workspace
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 6bcd937

Please sign in to comment.