Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

OCRnX in Void Loop section Not Working

2 posters

Go down  Message [Page 1 of 1]

1OCRnX in Void Loop section Not Working  Empty OCRnX in Void Loop section Not Working Sun Jun 27, 2021 8:16 am

joeyd11ph



//OCRnX in Void Loop section Not Working, i.e. if I want to use POT to control the duty Cycle

int Pin=9;
void setup()  {
pinMode(Pin, OUTPUT);
pinMode(10,OUTPUT);
TCCR1A=0;//reset the register
TCCR1B=0;//reset the register
TCNT1=0;
TCCR1A=0b10100011;
TCCR1B=0b00000011;
//OCR1A=768;// instead in Void loop
OCR1B=400;

}
void loop()  {
OCR1A=768;
}

In actual Arduino this sketch is working, in SimulIDE no signal on pin 9. Im using UNO both on SimulIDE and in actual arduino board.

arcachofo

arcachofo

I will have a look.

But.. which simuilide version are you using?

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum