Ameba-AIoT / ameba-arduino-pro2

AmebaPro2 Arduino third-party package SDK
https://www.amebaiot.com/en/ameba-arduino-summary/
MIT License
49 stars 23 forks source link

Cant set PWM frequency #249

Open nsmith1024 opened 4 months ago

nsmith1024 commented 4 months ago

Boards

AMB82-Mini

External Hardware

NONE

Hardware Configuration

Using PWM

Version

latest dev (checkout manually)

IDE Name

Arduino IDE 2.3.2

Operating System

Windows

Auto Flash Mode

Disable

Erase All Flash Memory (16MB)

Disable

Standard Lib

Arduino_STD_PRINTF

Upload Speed

2000000

Description

How do i change the PWM frequency?

I tried using standard the Arduino functions

ledcAttach(PWM_PIN, FREQ, RESOLUTION); ledcWrite(PWM_PIN,pwm_value);

Both are undefined.

Please tell me how to set the PWM frequency, resolution, and duty cycle.

Thanks

Sketch

ledcAttach(PWM_PIN, FREQ, RESOLUTION);
 ledcWrite(PWM_PIN,pwm_value);

Error/Debug Message

undefined

Reproduce remarks

No response

I have checked online documentation, FAQ, GitHub Wiki and existing/closed issues.

github-actions[bot] commented 4 months ago

Hello, hope this message finds you well. Congrats to your first Issue! We will review it as soon as possiable. Feel free to have a look at https://www.amebaiot.com/en/ameba-arduino-summary/ for more information

nsmith1024 commented 4 months ago

There is no example for PWM itself, It shows a tone generator example, and servo example, but those doesnt allow direct control of the PWM.

The proper PWM functions ledcAttach(PWM_PIN, FREQ, RESOLUTION); and ledcWrite(PWM_PIN,pwm_value); are undefined in arduino.

Im trying to control a DC motor (not a servo, and not a stepper) just a regular DC motor using the PWM, where i need to change both the frequency and duty cycle.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 14 days with no activity.