Тёмный

What is Serial.begin(9600)? 

Programming Electronics Academy
Подписаться 227 тыс.
Просмотров 42 тыс.
50% 1

🤩 FREE Arduino Crash Course 👇👇
bit.ly/get_Arduino_skills
Want to learn more? Check out our courses!
bit.ly/2QcIL2u
**Get the code, transcript, challenges, etc for this lesson on our website**
bit.ly/3uTMjFK
We designed this circuit board for beginners!
Kit-On-A-Shield: amzn.to/3lfWClU
SHOP OUR FAVORITE STUFF! (affiliate links)
---------------------------------------------------
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/
WHAT IS SERIAL.BEGIN(9600)?
Are you wondering what Serial.begin(9600) does?
You’ve probably seen it in most of the Arduino programs you’ve looked at - but what’s it there for?! Do you even need to use Serial.begin()?
What if you change the number 9600? I mean, what’s 9600 even mean?!
In this lesson you will learn exactly what Serial.begin does, when you NEED to use it, and what the heck the 9600 means.
WHAT DOES SERIAL.BEGIN(9600) DO?
Let’s get straight to this…
Serial.begin() establishes serial communication between your Arduino board and another device. The most common use of serial communication you will establish is between your Arduino and your computer via a USB cable - or should I say a Universal Serial Bus cable.
When you have established serial communication between two devices, it allows the two devices to communicate using a serial protocol.
So let’s answer a couple practical questions…
WHEN DO I NEED TO USE SERIAL.BEGIN()?
The most common reason to use serial.begin() is when you want to output some information from your Arduino to your computer screen.
That is, you want to print some text out.
The function used to display text on your computer screen from your Arduino board is the serial.print() function.
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print("Look Ma, I’m in the phone book!");
}
The text that gets printed out shows up on the Serial Monitor window - which can be opened from the menu bar under Tools / Serial Monitor. Or with the shortcut key CTRL + SHIFT + M (on PC) or Command + Shift + M (MacOs).
There are other times you’ll use serial.begin(), for example, maybe you have an application running on your computer that will be expecting data from your Arduino over a serial port. In these cases, you’ll also need Serial.begin().
WHERE DOES SERIAL.BEGIN() GO IN THE ARDUINO SKETCH?
99% of the time, you’ll be putting the Serial.begin() function inside of the setup() function. As you may know, setup() only runs once, and since you’ll only need to establish the Serial Communication one time - it makes sense to have it there.
WHAT’S WITH THE NUMBER 9600?
That number is called the baud rate. Probably the most important practical thing you need to know, is that for serial communication to work the baud rate in Serial.begin() and the baud rate set on the receiving device need to match.
If you are using the Arduino IDE Serial Monitor window to read the information from your Arduino, then you can use the baud rate drop down to set the baud rate.
Remember! If these two values don’t match - then anything you try to send over serial will not work right.
It’s like, as a kid, did you and a friend ever come up with a long distance communication protocol?
Like, 2 hoots meant, “Is anyone at the fort?”, and the appropriate response was two hoots back?
But if you both didn’t agree on that protocol beforehand, and your friend was cawing, instead of hooting, then you were like, what is he trying to say? Same thing with the baud rate - remember these have to match!

Опубликовано:

 

16 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 39   
@Sekhar_Home
@Sekhar_Home 3 года назад
We need more and more tutorials like this in future. Ur content are so clear and to the point.
@programmingelectronics
@programmingelectronics 3 года назад
Thanks!
@TheJimtanker
@TheJimtanker 3 года назад
Have you checked out what they have on their website?
@Sekhar_Home
@Sekhar_Home 3 года назад
@@TheJimtanker yes of course
@DaisyHollowBooks
@DaisyHollowBooks 11 месяцев назад
Totally.
@Anthonylopez-rd7nr
@Anthonylopez-rd7nr 3 года назад
This is one of the reason I signed up, best learning program techniques I ever had. 😊
@programmingelectronics
@programmingelectronics 3 года назад
Thank Anthony!
@kersem21.k4
@kersem21.k4 Год назад
Thank you! It was very helpful
@Clip7heApex
@Clip7heApex 2 года назад
Can you have 2 baud rates for different pieces of equipment on different serial busses in the same program. For example a thermocouple device on one spi bus and an spi tft screen that runs at a different speed.
@pokeethan
@pokeethan Год назад
Super helpful!
@manoloor5883
@manoloor5883 2 года назад
Wonderful explanation!! Thank you
@programmingelectronics
@programmingelectronics 2 года назад
I appreciate that! Thanks for watching!!
@earthianprithviwasi
@earthianprithviwasi 3 года назад
Thanks for the helpful video!!
@programmingelectronics
@programmingelectronics 3 года назад
Thanks for watching!
@hernanmorales1654
@hernanmorales1654 Год назад
Listo para la exposición, gracias!
@nabeelest
@nabeelest 2 года назад
Love these videos!
@programmingelectronics
@programmingelectronics 2 года назад
Glad you like them!
@DaisyHollowBooks
@DaisyHollowBooks 11 месяцев назад
I'm just starting out; this was helpful. Thanks.
@programmingelectronics
@programmingelectronics 11 месяцев назад
Glad it was helpful!
@JustJimWillDo
@JustJimWillDo 2 года назад
So apart from making sure that they match, are there any advantages to a faster or slower baud rate?
@MauriceBoulard
@MauriceBoulard 2 года назад
that's the main question but the guy doesn't give the fundamental meaning of the baud
@twinomugishahadassahlove9147
thank you so much very helpful
@programmingelectronics
@programmingelectronics Год назад
Glad it helped Twinomugisha!
@joshuapitong899
@joshuapitong899 2 года назад
Lot of thanks.🙌
@programmingelectronics
@programmingelectronics 2 года назад
Thanks so much for the note!!!
@MuntasirAhmed-cu8gm
@MuntasirAhmed-cu8gm 3 месяца назад
very helpfull THX
@programmingelectronics
@programmingelectronics 3 месяца назад
Thanks so much for watching - all the best!
@umargul5644
@umargul5644 2 года назад
Great 👍
@programmingelectronics
@programmingelectronics 2 года назад
Thanks so much!
@johncoit5238
@johncoit5238 3 года назад
Board rate
@ptptp7826
@ptptp7826 28 дней назад
Your voice sounds more natural with 2.5x playback speed 😂
@tarunkr5352
@tarunkr5352 3 года назад
This recommendation can't be a coincidence..
@simonhopkins3867
@simonhopkins3867 3 года назад
Tooooot. Tooooot. 2 u 2
@DivyaK-xh3oy
@DivyaK-xh3oy 4 месяца назад
😂
@ahmadjaradat3011
@ahmadjaradat3011 3 месяца назад
Thank you! It was very helpful
@abhisekroy7426
@abhisekroy7426 2 года назад
It's really helpful!! Thanks!!
@programmingelectronics
@programmingelectronics 2 года назад
Great! Thanks so much for the note!
Далее
Using Serial.read() with Arduino | Part 1
10:30
Просмотров 130 тыс.
Serial Communication with Arduino - The details!
16:51
Зачем он туда залез?
00:25
Просмотров 63 тыс.
Arduino Sketch with millis() instead of delay()
14:27
Просмотров 225 тыс.
What is Bit Rate vs. Baud Rate?
4:08
Просмотров 11 тыс.
How a CPU Works
20:42
Просмотров 8 млн
Using tabs to organize code with the Arduino IDE
12:18
Using Arrays with Arduino
13:51
Просмотров 28 тыс.
Using Serial.parseInt() with Arduino
15:39
Просмотров 46 тыс.