Это видео недоступно.
Сожалеем об этом.
Effortlessly Communicate Between Two Arduinos with Just Two Wires!
HTML-код
- Опубликовано: 17 авг 2024
- Discover how to easily enable communication between two Arduinos using only two wires in this beginner-friendly tutorial.
Compatible with Nano or Uno boards, this guide will walk you through the process of setting up serial communication on SDA and SCL interfaces using code that hides the complexity.
🔔 Support the channel🔔
www.buymeacoff...
Arduino Nano:
amzn.to/3DnUH7f
Please note that the product links are Amazon affiliate links. As an Amazon Associate, I earn from qualifying purchases at no additional cost to you. This helps support the channel and allows me to continue creating content for you. Thank you for your support!
Get the code and the library :
Arduino A : dev.azure.com/...
Arduino B:
dev.azure.com/...
Chapters:
0:00 Intro
0:53 Wiring Nano, Uno
2:11 Setup in Arduino IDE
3:04 Install the library for Arduino A
3:46 Selecting the right COM port
6:36 Using the library
8:25 Get Incoming Messages
10:00 Code for Arduino B
11:45 Arduino B send a message to Arduino A
13:16 Arduino B send a number to Arduino A
14:23 Arduino A send a message and a number to Arduino B
15:32 Wiring for using a push button and LED on each Arduino
17:05: Arduino A control LED of Arduino B
28:42: Arduino B control LED of Arduino A
30:20: A use case for communication between two Arduino
#arduino #programming #coding #beginners #tutorial #guide #stepbystep #ArduinoCommunication #TwoWire #ArduinoTutorial
Thanks for this video, it was really helpful. I have a question: can I use the same A4 and A5 pins for communication with a Real Time Clock as well as another arduino board as you used in this video?
Note that I think this will only work up to about 1 meter apart since it uses the I2C interface. Slowing down the baud rate of that interface could make that a little longer at the sacrifice of throughput.
Maybe, never tried it
Thanks for the video ,i have a question , if i use an uno with pin 4 and 5 used for my i2c lcd as my main controller and i use a n nano with a rotary controller would i t be possible to use pin 27 and 28 for the connection and will it work . secondly when i send an int that is determined by the rotary count on the rotary controller how do i insert that value in an int . lets call it "Pause" on the uno
The Arduino Nano does not have pins 27 and 28. It has 14 digital pins (D0-D13) and 8 analog pins (A0-A7). On the Nano, the I2C communication uses the following pins:
A4: SDA (data line)
A5: SCL (clock line)
To communicate between an Arduino Uno and an Arduino Nano using I2C, you would connect the SDA and SCL lines of both boards together, ensuring that the master and slave roles are correctly assigned in your code.
Thank you for a great tutorial. I have a few questions about the initial test code.
First, since you didn't set a pin number, how is LED_BUILTIN working?
Second, in your "inverted" function, your declare the variable "led", but there is no reference to pin 13, the built in LED. How does this work??? Thanks very much.
If you look at the code for both nano (links in the video description), you will see that the LED is defined, as its PinMode
Do you need shared ground for communication?
Yes
can i connect more than two arduinos?
yes, the i2C protocol can have many devices connected
@@thelastoutpostworkshop I have to specify an address for each one? And kindly, can you tell me how to transmit for example, one message to three Arduino just in simple words. Also, how can I transmit a float or sensor reading From one Arduino which sensor is attached to other to Arduino.
Thank you so much
Thanks for this video, it was really helpful. I have a question: can I use the same A4 and A5 pins for communication with a Real Time Clock as well as another arduino board as you used in this video?
I have never trried it