Recently, I made an Arduino project to dim and brighten a LED with a potentiometer. I used the above code. Please explain the significance of potValue/4 in the analogRead() function.
Thanks in advance 🙂
The analog input is 0 to 1023 whereas the analog output is 0 to 255.
https://www.instructables.com/Controlling-LED-by-Potentiometer-With-Arduino-Uno-/
instead of a resistor can a use a rotary encoder to ramp the voltage of 12 volts dc from 0 to 12 volts but only use 45 to 60 degrees of rotation? i was thinking i saw you make a car and it had a pwm and used a analog of 0 to 1023 or you coverted it to 0 to 255 in the program.
i could do this and put in the program for every step in the encoder the program would be 1/2 volt. depending on how far i would want the rotary encoder to turn. so if the encoder steped 24 times @ 1/2 volt i would get 12 volts out put from let say 40 degrees depends on the rotary encoder and how many steps it has, and if i wanted less of more could i change the voltage per step or the steps per voltage?
i think i am starting to get the pwm encoder part i need to learn the code to make it work.
then i would need to figure out how to use a mosfet for high amp out put.
is there a mosfet that opperates on a 0 to 12 volts to have the voltage rise and fall for 12 volts?
it would be best if i had 60 steps or more to control the voltage. is there a way to control the voltage by rotary encoder of 1tenth volt per space? i just do not know how to adjust the rotation of the rotary encoder.
the reason i want to use a encoder is that it will last for ever and it would rotate so much smoother with no contacts.
i hope some knows how to do this opperation.
Recently, I made an Arduino project to dim and brighten a LED with a potentiometer. I used the above code. Please explain the significance of potValue/4 in the analogRead() function.
Thanks in advance 🙂
Analog input provides 10 bit resolution (2^10) == 1024 values (0-1023)
Digital output provides 8 bits of resolution (2^8) == 256 values (0-255)
= (2^10) / (2^8) == 1024 / 256 = 4
So in essence it's just another way to map values from analog to digital.
Anyone has any idea how to use this in a breadboard? (I don't know how to solder)
Nope. You have to solder some leads onto it. Or maybe use wires with alligator clips on each end and clip onto the end of one of the wires you are using to to connect up your breadboard . Soldering is an important part of an electronic hobby. Can you get this type from your supplier?
@robotbuilder Yeah. I will try to get this type.
Thanks for the idea of alligator clips. 😀