Hi everybody, i have 2 questions about sending pulses
Question 1
In my project, i want to send some pulses to one pin, and i'd like to know the best way to do it
Example
2º question. If i use many times the command Delaymicroseconds to send pulses, maybe the board can have a problem in the future?
Thanks in advance
Question 1
In my project, i want to send some pulses to one pin, and i'd like to know the best way to do it
Example
With standard frequency 490 hz ( Period of 2 mms )
If i want to send 200 pulses ( half of period in high, half of period in low)
Option 1
Code:for (int i=0; i<200; i++) { digitalWrite(pulsePin, HIGH); delayMicroseconds(1000); o delay(1) digitalWrite(pulsePin, LOW); delayMicroseconds(1000); o delay(1) }
Option 2
Code:analogWrite(pulsePin, 127); delay(400); (2 mms each period * 200) analogWrite(pulsePin, 0);
2º question. If i use many times the command Delaymicroseconds to send pulses, maybe the board can have a problem in the future?
Thanks in advance