Skip to content

Commit

Permalink
Allow to set PWM frequency to avoid noise
Browse files Browse the repository at this point in the history
  • Loading branch information
DrA1ex committed Sep 27, 2024
1 parent a3153de commit 37b4575
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ void setup() {

analogWriteResolution(PWM_RESOLUTION);

#ifdef ARDUINO_ARCH_ESP8266
analogWriteFreq(PWM_FREQUENCY);
#else
analogWriteFrequency(PWM_FREQUENCY);
#endif

ApplicationInstance.begin();
}

Expand Down
1 change: 1 addition & 0 deletions src/sys_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define PIN_ENABLED (HIGH)

#define PWM_RESOLUTION (14u)
#define PWM_FREQUENCY (22000u)
#define PWM_MAX_VALUE ((uint16_t)((1u << PWM_RESOLUTION) - 1))

#define NTP_UPDATE_INTERVAL (24ul * 3600 * 1000)
Expand Down

0 comments on commit 37b4575

Please sign in to comment.