PWM not working on Arduino Mega 2560

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Tito
Posts: 3
Joined: Sun Mar 20, 2016 6:02 pm
Been thanked: 1 time

PWM not working on Arduino Mega 2560

Post by Tito »

Hello guys,

I'm fairly new to the programming community, everything was going fine but I can't get PWM to work properly.

I connected a LED to pin 4 on port B (pin 10 PWM)
However, I can light the LED in this pin, but I can't control it with a PWM.

I've set the PWM channel to 10. This should be working right?
The PWM is enabled outside the loop and has a delay behind.
I think there some setup wrong somewhere but I can't find it... Even after a long search.

I've attached the program which I used.

Regards,
Attachments
Flowcode3.fcf_avr
(8.5 KiB) Downloaded 356 times

User avatar
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: PWM not working on Arduino Mega 2560

Post by Benj »

Hello,

Which version of Flowcode are you using? Looks like a v5 file but could be v4?

Tito
Posts: 3
Joined: Sun Mar 20, 2016 6:02 pm
Been thanked: 1 time

Re: PWM not working on Arduino Mega 2560

Post by Tito »

I'm sorry this is a V5 file. The new topic button disappeared in the V5 section for me. I don't know if this a known problem or if it only shows for me.

Tito
Posts: 3
Joined: Sun Mar 20, 2016 6:02 pm
Been thanked: 1 time

Re: PWM not working on Arduino Mega 2560

Post by Tito »

Well, I figured this out.

PWM pin 10 is Port B4 and channel 6. The pin number and channel confused me.
I found out after downloading V6. When using V6 the PWM component shows port output with the channel. Therefore I found out when connecting to channel 10 it was actually B7. And setting it to channel 6 it connected to pin 10.

I copied this action to the V5 version and it worked. Now considering buying FC V6. Just need to see if its worth the money (on first look its way more expanded than V5). I guess I have 30 days to think about it, lol.

User avatar
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: PWM not working on Arduino Mega 2560

Post by Benj »

Brilliant, thanks for letting us know.

Hope you enjoy the v6 30 day trial. Let us know if you have any problems.

Post Reply