![]() Many pins of the arduino are capable of more than one of those functions, you can check this by looking up "arduino pinout" for your particular board. Also can be used to switch on and off another fast component, like a transistor, which in turn will switch on and off a load (say a motor) and thus you can control the rotation speed of said motor. This is useful for controlling a varying output, say the brightness of an LED, the position of a servo motor (this is a deeper subject, because the servo motor has a little "brain" of its own, which translates the incomming PWM into angle of rotation). It's a clever technique called "pulse width modulation", where the microcontroller will turn the output ON for a set period of time (duty cycle) and then turn it off for some time. ![]() It's not REALLY a smooth transition and it's not exactly a varying voltage, but rather varying on/off period by quickly switching the output on and off. PWM pins are capable of WRITING a voltage between 0V and +5V. This is useful when you want to measure brightness LEVEL (not just light on or off), or read a potentiometer value (for controlling the brightness of an LED for instance) and other similar purposes. You decide whether they read or write when you declare pinMode() Īnalog pins are capable of READING (this is key) a voltage between 0V and +5V (which is translated into a value between 0 and 255 when you use analogRead() function). Long answer - yes, but check pinout diagram for your boardĮssentially the arduino has 3 types of pins (there are more, but for the sake of this thread we'll say 3).ĭigital pins are capable of reading or writing either ON or OFF (let's say 1 or 0, HIGH or LOW, voltage +5V or 0V).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |