This might be me - PWM doesn't seem to work on Arduino (I tested Nano)
Using Channel 6 (Pin D3) - PWM::Enable() and PWM::SetdutyCycle(200) - just gives no output on pin.
Using Arduino IDE and pinMode(3, OUTPUT); analogWrite(3, 200); - gives a very nice square wave with 78.4% duty cycle as expected..
Am I doing something wrong - I tried various PWM channels / combinations of speeds.
Martin
How it should look:
Arduino PWM
Moderator: Benj
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Arduino PWM
Hi Martin!
You deserve an answer. Maybe no help, but here my test.
When I test with your testprogram With cal., your rigth, no PWM out.
I made a test with the PWM component and it work. Maybe stupid question, why use the cal? I know it has something to do with creation component or simulation. I have no experience with this, probably a fault from me
Br Jorgen
You deserve an answer. Maybe no help, but here my test.
When I test with your testprogram With cal., your rigth, no PWM out.
I made a test with the PWM component and it work. Maybe stupid question, why use the cal? I know it has something to do with creation component or simulation. I have no experience with this, probably a fault from me
Br Jorgen
- Attachments
-
- PWM_Martin.fcfx
- (7.32 KiB) Downloaded 170 times
-
- Valued Contributor
- Posts: 1189
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 439 times
- Contact:
Re: Arduino PWM
Hi Jorgen,
Many thanks for that - works perfectly... Why did I use CAL - I searched for the PWM component - and it was the first I found.
Had never used PWM before.... Should have used search rather than looking through the component lists....
Martin
Many thanks for that - works perfectly... Why did I use CAL - I searched for the PWM component - and it was the first I found.
Had never used PWM before.... Should have used search rather than looking through the component lists....
Martin
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
- Contact:
Re: Arduino PWM
Hi Martin!
Glad I was able to help you and maybe a little repay with a fraction for your always helping.
Br. Jorgen.
Glad I was able to help you and maybe a little repay with a fraction for your always helping.
Br. Jorgen.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Arduino PWM
Hello,
Glad you've got it working. Sorry for the lack of a reply.
The PWM component uses the CAL component behind the scenes but also calls the ChangePeriod function as part of the Enable macro which is probably the bit you were missing from your CAL program.
Glad you've got it working. Sorry for the lack of a reply.
The PWM component uses the CAL component behind the scenes but also calls the ChangePeriod function as part of the Enable macro which is probably the bit you were missing from your CAL program.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel