DaveX
July 31, 2024, 5:48am
8
I think you want to vary the duty cycle, and those lines are key, but it is unclear if you want to vary it based on the PID's Output or an analogRead(A0).
I remember this thread:
Run IoT and embedded projects in your browser: ESP32, STM32, Arduino, Pi Pico, and more. No installation required!
and
What code have you written? And what problems does it have?
Here's a 1Hz Mode 8 using NickGammon's TimerHelpers.h with a 25% complimentary duty cycle:
#include "TimerHelpers.h" // https://www.gammon.com.au/forum/?id=11504
// for https://forum.arduino.cc/t/two-pwm-signals-on-pins-9-and-10-with-input-on-a1-signals-need-to-be-180-degrees-apart/1280072/4?u=davex
void setup() {
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
TCCR1A = 0; // reset timer 1
TCCR1B = 0;
// set up Timer 1
…