will this produce a PDW signal with approximately a 50% duty cycle?
which pin on which connector will change? (I'm confused as hell on Giga R1 pin numbers!)
will the "square wave" continue until I write to the pin again?
What will the frequency be?
Can I adjust the frequency?
Note I don't want to put it in loop as it will burn up procesor time. I'm hoping to be able to write to it once and have it keep outputting until I turn it off or change the level later on.
(3) Yes! (4) 490 Hz (see Fig-1) (5) No! But, you can adjust the duty cycle. (6) Once you execute the analogWrite() function, the wave will be automatically sustaining at the background on the target pin.
Thanks to all for the helpful response.
To recap here are the answers to my questions:
Q-1 - will this produce a PDW signal with approximately a 50% duty cycle?
A-1 - yes
Q-2 - which pin on which connector will change? (I'm confused as hell on Giga R1 pin numbers!)
A-2 - Pin-d9 which is equivalent to pin-9 on the Digital Connector
similarly...
analogWrite(10,126); will write to pin-d10 which is equivalent to pin-8 on the Digital Connector
analogWrite(2,126); will write to pin-d2 which is equivalent to pin-16 on the Digital Connector
etc,,, And yes it can get confusing. See Product Reference Manual page-15 which list all 26-pins on the digital connector but note the connector pin numbers do not correspond to the "d" numbers.
Q-3 will the "square wave" continue until I write to the pin again?
A-3 Yes it will. You only need to executive analogWrite(pin,value) once to get the PWM signal going.
To change the duty cycle of the PWM signal you just do another analogWrite(pin,value) or to stop it you can do a digitalRead or digitalWrite to the same pin.
Q-4 What will the frequency be?
A-4 - My scope counter says 500Hz
Q-5 Can I adjust the frequency?
A-5 I've been unable to discover a documented way to do this but I'm sure there is a way.
I'm guessing this is done by triggering an internal counter every "cycle" so with some custom code you should be able adjust the trigger rate to change the frequency of the PWM signal... if required.
Hope this helps anyone else with similar questions.