erropix / esp32_analogwrite Goto Github PK
View Code? Open in Web Editor NEWProvides an analogWrite polyfill for ESP32 using the LEDC functions
License: MIT License
Provides an analogWrite polyfill for ESP32 using the LEDC functions
License: MIT License
#include <Arduino.h>
#include <analogWrite.h>
int brightStep = 1;
int brightness = 0;
uint8_t ledR = 34;
uint8_t ledG = 35;
uint8_t ledB = 32;
uint8_t ledW = 33;
void setup()
{
// Set resolution for a specific pin
analogWriteResolution(ledR, 12);
analogWriteResolution(ledG, 12);
analogWriteResolution(ledB, 12);
analogWriteResolution(ledW, 12);
analogWrite(ledR, 255);
analogWrite(ledG, 255);
analogWrite(ledB, 255);
analogWrite(ledW, 255);
}
void loop() {}
This outputs
ledR = 0 = GPIO34
ledG = 0 = GPIO35
ledB = 1.6 V = GPIO32
ledW = 1.6 V = GPIO33
Why?
Your fade example on the main page is defining "step", but the variable being used is called 'brightStep'. The example in the "examples' folder is correct - but if someone just does a simple cut-n-paste of the code as shown on the main page it will not compile.
I was working nearly half day to pinpoint why some of the my esp32 pins not working. when changing analogwrite to digital it suddenly start working. I think those pins dont support pwm.
Have you tried asking Arduino for adding to index? If not, could I ask?
Which license covers this library? I'd be glad for MIT, because I reused your example for testing with Travis and I'd like it to stay as example (Our library is licensed under MIT and I would have to write my own library otherwise).
Hi,
thanks for the great pojekt.
There is a little mistake in the readme. Under the point PWM Frequency you mixt the function names analogWriteFrequency and analogWriteResolution:)
Lucas
I thought the esp32 can use almost all pins for PWM but I made a program that needs 9 pins to analogWrite to. What pins can I use for this? Some are not working. I am using the WiFi library.
I just download and copy your library to ESP32 arduino library folder. like this : C:\Users\Administrator\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\libraries
But I can't find it in Arduino IDE. I really want to use this library. So can you tell me how to install your library? Thank you so much.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.