Browse Source

Add 2nd channel

master
Thorsten Riess 1 year ago
parent
commit
b487bcd6a7
1 changed files with 17 additions and 8 deletions
  1. +17
    -8
      main/laserpong_main.c

+ 17
- 8
main/laserpong_main.c View File

@@ -34,14 +34,23 @@ void app_main()

ledc_channel_config_t ledc_conf;
ledc_conf.channel = LEDC_CHANNEL_0;
ledc_conf.duty = 3276; //800; //3276; //1638; // to 3276
ledc_conf.duty = 3276; //900; //3276; //1638; // to 3276 // 0 - 2088 (actually a bit less than that)
ledc_conf.gpio_num = 15;
ledc_conf.intr_type = LEDC_INTR_DISABLE;
ledc_conf.speed_mode = LEDC_HIGH_SPEED_MODE;
ledc_conf.timer_sel = LEDC_TIMER_0;
ledc_channel_config(&ledc_conf);

LEDC_CHANNEL_1
ledc_channel_config_t ledc_conf2;
ledc_conf2.channel = LEDC_CHANNEL_1;
ledc_conf2.duty = 3276; //900; //3276; //1638; // to 3276 // 0 - 2088 (actually a bit less than that)
ledc_conf2.gpio_num = 13;
ledc_conf2.intr_type = LEDC_INTR_DISABLE;
ledc_conf2.speed_mode = LEDC_HIGH_SPEED_MODE;
ledc_conf2.timer_sel = LEDC_TIMER_0;
ledc_channel_config(&ledc_conf2);

//LEDC_CHANNEL_1

/* Print chip information */
esp_chip_info_t chip_info;
@@ -59,12 +68,12 @@ void app_main()
for (int i = 10; i >= 0; i--) {
printf("Restarting in %d seconds...\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
if(ledc_conf.duty > 1000) {
ledc_conf.duty = 800;
} else {
ledc_conf.duty = 3276;
}
ledc_channel_config(&ledc_conf);
//if(ledc_conf.duty > 1000) {
// ledc_conf.duty = 800;
//} else {
// ledc_conf.duty = 3276;
//}
//ledc_channel_config(&ledc_conf);
}
printf("Restarting now.\n");
fflush(stdout);

Loading…
Cancel
Save