Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:24 12 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Pico PWM question

Author Message
apalert
Newbie

Joined: 06/07/2023
Location: Australia
Posts: 35
Posted: 09:53am 04 Jan 2025
Copy link to clipboard 
Print this post

Struggling to get channel B working on a pico. Wanting to use pin 12 which is PWM4B. In the following code, entered at the console prompt, pin 11, which is PWM4A, works fine. Pin 12 I come to grief!

> setpin 11, pwm
> pwm 4, 100, 50
> pwm 4, off
>
> setpin 12, pwm
> pwm 4, 100, 50
Error : Pin not set for PWM
> pwm 4b, 100, 50
Error : Expression syntax
>

Appreciate if someone can put me out of my misery :)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10243
Posted: 09:59am 04 Jan 2025
Copy link to clipboard 
Print this post

From the manual

  Quote  PWM channel, frequency,[dutyA][,dutyB][,phase][,defer]


So if I don't want dutyA but do want dutyB it becomes

PWM channel, frequency,,dutyB[,phase][,defer]
 
apalert
Newbie

Joined: 06/07/2023
Location: Australia
Posts: 35
Posted: 10:23am 04 Jan 2025
Copy link to clipboard 
Print this post

Awesome, thanks Peter
I did read manual I promise, just too dense to figure it out! Your example was a great help.
 
Canada_Cold
Regular Member

Joined: 11/01/2020
Location: Canada
Posts: 42
Posted: 11:46am 04 Jan 2025
Copy link to clipboard 
Print this post

apalert,

I worked on a project last fall that required a PWM output.   I found the following post Very helpful.

"PWM out, need some examples, not working for me."

https://thebackshed.com/forum/ViewTopic.php?TID=16947&PID=221685#221685


Don
 
apalert
Newbie

Joined: 06/07/2023
Location: Australia
Posts: 35
Posted: 03:24am 05 Jan 2025
Copy link to clipboard 
Print this post

  Canada_Cold said  apalert,

I worked on a project last fall that required a PWM output.   I found the following post Very helpful.

"PWM out, need some examples, not working for me."

https://thebackshed.com/forum/ViewTopic.php?TID=16947&PID=221685#221685


Don


Thanks Don
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025