Hello every body
I am trying to get a PWM that sweep from a min to max value, with controllable frequency.
I really get the signal as I expected!
but now I am wondering how can change the amplitude of the signal in my code:
I am waiting for your help
I am trying to get a PWM that sweep from a min to max value, with controllable frequency.
I really get the signal as I expected!
but now I am wondering how can change the amplitude of the signal in my code:
Code:
int minimum_pwm_value=10;
int maximum_pwm_value=150;
// to determine the range of PWM to sweep
void setup() {
// put your setup code here, to run once:
pinMode(9, OUTPUT);//PWM PIN
analogWriteResolution(8); // can be 2-16 bit
Serial.begin(9600);
delay(2);
}
void loop() {
// put your main code here, to run repeatedly:
analogWriteFrequency(9, 100); // FREQ IN Hz
for (int i=minimum_pwm_value;i<=maximum_pwm_value;i++)
{ analogWrite(9,i);//0-255 / pwm value / 8bits
delay(10);
}
}
I am waiting for your help