🤩 FREE Arduino Crash Course 👇👇
bit.ly/get_Arduino_skills
**If you like this, I think you'll like the premium Arduino training we offer. Check it out here** bit.ly/3nSBPUs
We designed this circuit board for beginners!
Kit-On-A-Shield: amzn.to/3lfWClU
SHOP OUR FAVORITE STUFF! (affiliate links)
---------------------------------------------------
Get your Free Trial of Altium PCB design Software
www.altium.com/yt/programming...
We use Rev Captions for our subtitles
bit.ly/39trLeB
Arduino UNO R3:
Amazon: amzn.to/37eP4ra
Newegg: bit.ly/3fahas8
Budget Arduino Kits:
Amazon:amzn.to/3C0VqsH
Newegg:bit.ly/3j4tISX
Multimeter Options:
Amazon: amzn.to/3rRo3E0
Newegg: bit.ly/3rJoekA
Helping Hands:
Amazon: amzn.to/3C8IYXZ
Newegg: bit.ly/3fb03X1
Soldering Stations:
Amazon: amzn.to/2VawmP4
Newegg: bit.ly/3BZ6oio
AFFILIATES & REFERRALS
---------------------------------------------------
►Audible Plus Free trial: amzn.to/3j5IGrV
►Join Honey- Save Money bit.ly/3xmj7rH
►Download Glasswire for Free:bit.ly/3iv1fql
FOLLOW US ELSEWHERE
---------------------------------------------------
Facebook: / programmingelectronics...
Twitter: / progelecacademy
Website: www.programmingelectronics.com/
Click Below to Read About This Topic on Our Website
www.programmingelectronics.co...
Description:
Arduino Course for Absolute Beginners
Knowing if something is on or off can be extremely useful, but often you will want to know more. How bright is the light? How fast is the satellite moving? These types of answers are often analog - they cover a large range of values, not just on or off.
The Arduino handles analogs inputs with 6 dedicated pins, labeled A0 through A5. These pins have access to an analog-to-digital converter, which takes the range of input values and creates a digital version by cutting up the range into tiny pieces. All this is handled behind the scenes - all you have to do is use some very simple functions and you will get what you need.
You Will Need
Potentiometer (any resistance range will work)
Jumper Wires - at least 3
Solderless breadboard
Bicycle tire
Step-by-Step Instructions
Place your potentiometer into your breadboard.
Run a jumper wire from the 5-Volt pin of the Arduino either one of the outside pins of your potentiometer.
Run another jumper wire from one of the ground pins on your Arduino (labeled GND) to the other outside pin of your potentiometer.
Run the final jumper wire from pin A0 on your Arduino to the middle pin of the potentiometer.
Plug your Arduino into your computer.
Open up the Arduino IDE.
Go to File, Examples, 01.Basics, AnalogReadSerial
Click the Verify button on the top left side of the screen. It will turn orange and then back to blue once it has finished.
Click the Upload button (next to the Verify button). It will turn orange and then back to blue once it has finished.
On the menu bar, go to Tools, Serial Monitor - this will open the Serial Monitor window - you should see numbers rolling down this screen.
Now adjust the knob of your potentiometer and watch the serial monitor window, the numbers should adjust between 0 and 1023.
Circuit Talk
Current will run from high voltage to low voltage, thus current will move from the 5-volt pin to the ground pin - through the potentiometer. The two outer pins on the potentiometer are connected through a resistive "ring". The center pin of the potentiometer is connected to a wiper that moves along the resistive ring when you adjust the knob.
As you adjust the resistance by turning the knob on your potentiometer, the voltage being applied at the center pin changes. This voltage is what your analog pin is detecting as input. The analog-to-digital converter takes this input signal and changes it to the discreet range of 0 to 1023, which can be read with the function analogRead() that we will discuss shortly.
In the further reading section at the end, I have linked to a good tutorial explaining potentiometers if you want more info than the minuscule description I have here.
This sketch starts with a multi-line comment describing the sketch and the circuit. You will probably notice that the first block of code is the setup() function - we do not declare or initialize any variables at the beginning of this sketch - instead we will do this inside the loop() function, as in the last example. Inside the curly braces of setup() we revisit the Serial library and use the function Serial.begin().
Негізгі бет Ғылым және технология Tutorial 08: analogRead() and the Serial Port: Arduino Course for Absolute Beginners (ReM)
Пікірлер: 205