Question: Suppose you are using a robot that has light sensors on its right and left sides, as shown. The light sensors are connected to analog

Suppose you are using a robot that has light sensors on its right and left sides, as shown.

Suppose you are using a robot that has light sensors on its

The light sensors are connected to analog input channels 1 and 9 of the TM4C ADC (channel 1 left sensor; channel 9 right sensor). Thus your program should sample both channels.

a. Initialize the ADC to use the channels as indicated. No interrupts are to be used. (7 pts)

i. Briefly describe the initialization tasks at a high level (at a higher level than C code or comments). What features need to be initialized and for what purpose? Do not provide specific register macros or bitwise operations.

ii. Next, write the code.

void init_ADC()

{

YOUR CODE HERE (suggestion: you may want to structure your code similar to the UART initialization given in question 3)

}

b. Complete the following function to read in the light sensor values and return them via the parameters. Use polling (i.e. no interrupt service routines). (5 pts)

void get_sensor_reading(int *left_sensor, int *right_sensor)

{

YOUR CODE HERE

}

The following is the UART initialization code from question 3:

right and left sides, as shown. The light sensors are connected to

analog input channels 1 and 9 of the TM4C ADC (channel 1

Turn away from light Front Robot Back Turn away from light Front Robot Back

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!