Facing difficulties to align the above definition of duty cycle with what I know:
duty cycle = ratio of ON to period.
Quote from net: A compressor, for example, that operates for 1 minute and then shuts off for 99 minutes, is said to have a duty cycle of 1 / 100 , or 1 percent .
hi so i took your advice to use the tone function as it allows me to now control the pitch/notes of the tone. I also added another variable that is controlled by a pot to control the delay of that tone as seen below. Now im wondering if i can set certain parameters from 0 to 65000 using a loop that only allows the user to pick a specific note in a scale for example a pentatonic scale.
int outputPin = 3;
int PitchPin = A4;
int DelayPin = A3;
int Pitch = 0;
int Delay = 0;
void setup() {
// put your setup code here, to run once:
pinMode(outputPin, OUTPUT);
pinMode(PitchPin, INPUT);
pinMode(DelayPin, INPUT);
Serial.begin(9600);
}
void loop() {
Pitch = analogRead(PitchPin);
Delay = analogRead(DelayPin);
tone(outputPin,Pitch, Delay);
delay(Delay);
}