CH32V003 - Analogwrite()

First thanks to the people there has made it possible to have the WCH (CH32V003xxx) processors as part of Arduino IDE.

Fantastic $0.10 processor.

I have tried to use analogwrite() for dimming a led, but unfortunately either I do something wrong or the command are not yet implemented.

Has anyone know-how about this issue?

I fully understand if the command is not yet implemented, but I'm missing library or using analogwriwe() in a wrong way, I would be very thankful if someone would give an hand.

Thanks in advance.

I'm using (PWM analog Pin).

Have added:
Boards Managers URLs field in the Arduino 2.0 IDE: “https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json”

Also Instalked liberary:
“CH32 MCU EVT Boards by WCH”

Note:
My code works fine with a Nano Board.

1 Like

Welcome to the forum

You started a topic in the Uncategorised category of the forum

Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics

You can't use an analogue pin with an analogWrite command, you have to use one of the PWM pins.

Please post your code correctly using code tags so we can see exactly what your are doing wrong.

Hi,

I use port PD2 ( TIM pin )

In what possible way is this:-

Look we have rules here which you seem to be ignoring, starting off with not posting in the correct category, and now refusing to comply with a standard requirement.

You might want to look at this How to get the best out of this forum before you proceed any further.

I know you are a beginner here, but if you want help you need to cooperate, because we are not mind readers.

Perhaps a bit late, but for your information: analogWrite() has only recently been added to the CH32 core. At the moment the latest published release (1.0.4) doesn't support analogWrite(), but the latest code in the GitHub repository does. I recently tested PWM to control a fan using the CH32V003 via a MOSFET. It also allows changing the frequency. PWM works for several output pins (but not for all).

3 Likes