PWM Control with LED [Resolved]

Hey all, Im in the third module doing PWM with LED, I was to try coding through GPIO 0 pin, I wrote down the following code,

<!doctype html>

I get the output as,

{“success”:“0”,“value”:“Invalid Pin”}


Also kindly explain what exactly is values 10, 100 & 200??

pwm works on only analog pins (A0,A1,A2,A3,4,5)

PWM means pulse width modulation

10,100,200 will be the cycle width

But in the tutorial coding, they have connected to GPIO 4, which I tried connecting to GPIO 0 and not A0-A3
Ya Im clear with PWM.
Cycle width do u mean ON time in ms?

ya that is on time and 4 and 5 is pwm pins see on the device there is a sinusoidal signal that represent that these pins are pwm pins or analog pin

I am not clear with your reply

@gowthamkrishnateja Also I could not see any tile symbol on my BOLT, its only in the picture that I can see.

Is There is no symbol before 4th and 5th pin?

Nope, I still searching to find the PWM pins in my bolt, as per manual there are 5 PWM pins (as per Module 2.2).
FYI this is my BOLT hardware :point_down: :point_down:

But in https://www.boltiot.com/product.php the tile symbol is added before pin 4 & pin 5!

oh okay did you try this on 4 and 5 pins ? is it is working on 4 and 5

Yes its working with pin 4 & pin 5, can u tell me what all the other PWM pins, as its said, BOLT have five PWM pins!

@PPV In my code above, why value 1000 & 200 gives same output?

Can u please elaborate how did u fix the values @ 10, 100, 200, I do understand that is the ON time.

Kindly reveal the PWM pins on BOLT, I could not check in my ablity!

Can any 1 reply on this pls!

The value which you are giving is on time :watch:10,100,200 these are not fixed values you can change the values of on time

Ya i get that, but what exactly are those?
Knowing that I can know the range of values, Min to MaX!

They are specification of the on time width of a one full pulse cycle

Hey I got that too, the vales are ON time values entered randomly.

My question is, the range of the output is 5V, how do we acquire 10, 100, 200(though they are random values)?

Hi,

PWM pins on Bolt version 1 are pins 1,2,3,4&5

Also the entire range of voltages from 0-5 volts is mapped between 0-255.
Hence to give a specific output voltage for example 2.5 just put it in the following formula

5 = 255
2.5 = x

x = (255 * 2.5) / 5
x = 127.5

Round of to closest integer in this case 127 / 128
Hence analogWrite with value 128 will give approx 2.5 volts on the output pin

2 Likes

Ok, now I am clear, just re-winded the course module on PWM.

Thanks!