byte outputPin = D4; void setup() { // put your setup code here, to run once: Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: //todo: make a blacklist of misbehaving frequecies long newFreq = random( 9, 20 ); long newDuration = random( 2048 ); long newDutyCycle = random( 6, 6 + PWMRANGE / 2 ) ; analogWrite( outputPin, newDutyCycle ); analogWriteFreq( newFreq ); Serial.println( "duty: " + (String)newDutyCycle + " freq: " + (String)newFreq ); delay( newDuration ); }