Hi,
I am trying today to create a class called myClass
. In this class I have a PwmOut
pointer declared as: PwmOut* my_pwm
. In my class constructor I do
this->my_pwm = new PwmOut(D9);
this->my_pwm->period_ms(1000);
this->my_pwm->pulsewidth_ms(500);
Then in my main i instantiate my class like this:
int main(void) {
myClass toto;
while (true) { wait(8); } //wait to be sure the program does not exit
return 0;
}
But when I plug the scope to see the pwm on my pin… Nothing works, just a LOW state…
Moreover, if I do it without class like this, it works:
int main(void) {
PwmOut my_pwm(D9);
my_pwm.period_ms(1000);
my_pwm.pulsewidth(500);
while(true) {wait(8);}
return 0;
}
Maybe I miss something, but I don’t see my error. Do you have any idea ?