lab4 ez
This commit is contained in:
parent
c17a6bb850
commit
56c5b81810
@ -179,7 +179,7 @@ void vScanTask(void *pvParameters){
|
|||||||
|
|
||||||
adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t));
|
adc_chars = calloc(1, sizeof(esp_adc_cal_characteristics_t));
|
||||||
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_chars);
|
esp_adc_cal_value_t val_type = esp_adc_cal_characterize(unit, atten, width, DEFAULT_VREF, adc_chars);
|
||||||
|
char text[100];
|
||||||
|
|
||||||
uint16_t measuredValues;
|
uint16_t measuredValues;
|
||||||
int v;
|
int v;
|
||||||
@ -196,8 +196,8 @@ void vScanTask(void *pvParameters){
|
|||||||
printf("V = %d mV\n", measuredValues);
|
printf("V = %d mV\n", measuredValues);
|
||||||
|
|
||||||
// Send message
|
// Send message
|
||||||
char text[100];
|
|
||||||
sprintf(text, "%d\r\n", measuredValues);
|
sprintf(text, "%d\n", measuredValues);
|
||||||
|
|
||||||
// Write data back to the UART
|
// Write data back to the UART
|
||||||
int length = uart_write_bytes(UART_PORT_NUM, (const char *) text, strlen(text));
|
int length = uart_write_bytes(UART_PORT_NUM, (const char *) text, strlen(text));
|
||||||
@ -239,12 +239,13 @@ void vUpdateLedTask(void *pvParameters) {
|
|||||||
|
|
||||||
/* duty cycle according to the color LED */
|
/* duty cycle according to the color LED */
|
||||||
if (strncmp(WHITE_LED_CMD, data, cmp_length) == 0) {
|
if (strncmp(WHITE_LED_CMD, data, cmp_length) == 0) {
|
||||||
|
ledc_set_duty_and_update(LEDC_LOW_SPEED_MODE,LEDC_CHANNEL_1,0,0);
|
||||||
|
ledc_set_duty_and_update(LEDC_LOW_SPEED_MODE,LEDC_CHANNEL_0,1024,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (strncmp(BLUE_LED_CMD, data, cmp_length) == 0) {
|
else if (strncmp(BLUE_LED_CMD, data, cmp_length) == 0) {
|
||||||
|
ledc_set_duty_and_update(LEDC_LOW_SPEED_MODE,LEDC_CHANNEL_1,1024,0);
|
||||||
|
ledc_set_duty_and_update(LEDC_LOW_SPEED_MODE,LEDC_CHANNEL_0,0,0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user