Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you fix this code? if (adc <512) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, 0);}} if (512
Can you fix this code?
if (adc<512) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, 0);}} if (512<=adc&adc<512*2) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, 0);}} if (512*2<=adc&adc<512*3) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, 0);}} if (512*3<=adc&adc<512*4) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3, 0);}} if (512*4<=adc&adc<512*5) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, 0);}} if (512*5<=adc&adc<512*6) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, 0);}} if (512*6<=adc&adc<512*7) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, 0);}} if (512*7<=adc&adc<512*8) {HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, 1);} else {{HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, 0);}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started