Arduino I2c Serial Communication | Arduino Master Slave Tutorial | Tinkercad

Sdílet
Vložit
  • čas přidán 11. 07. 2024
  • In this tutorial we are going to see about Arduino master slave serial communication. Arduino I2c communication between Arduinos, it can be helpful to set up two (or more!) Arduino boards to share information with each other. Connect pin A5 (the clock, or SCL, pin) and pin A4 (the data, or SDA, pin) on the master Arduino to their counterparts on the slave board. Make sure that both boards share a common ground. In order to enable serial communication, the slave Arduino must be connected to your computer via USB.
    ===========================================
    Reference:
    www.arduino.cc/en/Tutorial/Li...
    ===========================================
    Git hub for code:
    github.com/shazforiot/Arduino...
    ===========================================
    Follow me @:
    / thetips4you
    / @thetips4you
    / thetipsforyou
    www.thetips4you.com
    -----------------------------------------------------------------------------------
    Music credit: "Royalty Free Music from Bensound"
  • Věda a technologie

Komentáře • 57

  • @diye.28
    @diye.28 Před 2 lety

    i wonder how could this be possible using Mblock. I am looking forward to program my robot using 2 arduinos ans mblock.

  • @rafaeloliveira133
    @rafaeloliveira133 Před 2 lety

    Hi im haviong an issue with the wire library this is my code for some reason the if statements arent working it just does imediatly the Wire.write(0x00); and after Wire.write(0x01); can you help me?
    if (buton == 0);{
    Wire.beginTransmission(0x20);// first PCF
    Wire.write(0x00);
    Wire.endTransmission();
    }
    if (buton == 1);{
    Wire.beginTransmission(0x20);// first PCF
    Wire.write(0x01);
    Wire.endTransmission();
    }

  • @learningpower9437
    @learningpower9437 Před 2 lety +3

    Very interesting....Even more from the fact...that you program the event in the void setup....and even when there is nothing in the void loop() ....the event is properly acknowledged. Excellent demonstration!!!!

  • @remim9417
    @remim9417 Před 4 měsíci

    Bonjour ;-) BRAVO & MERCI , tutoriel simple et efficace.

  • @cagricetinerr
    @cagricetinerr Před 2 lety +1

    thanks man you rock !

  • @enea.crazzolara
    @enea.crazzolara Před 6 měsíci

    Hey, this video helped me a lot. I just wanted to ask one quick thing. In Master code at "EndTransmission()" do I have to add the number I put in "beginTransmittion(1)" in this case the "1"? And the same thing on Slave code at "Wire.read()" do I put the same number as in "Wire.begin(1)" the "1"? I wanted to ask this because I dont know if when using more slaves and coding "endTransmission()" it would end all transmissions or only the number I put in. Thank you.

    • @Thetips4you
      @Thetips4you  Před 6 měsíci +1

      Yes, use the same number. It can be any number but should match.

  • @dnyautechnology2023
    @dnyautechnology2023 Před 3 lety

    that is very cool .how can i connect 2 arduino that already have midi code

  • @lawrenceking7498
    @lawrenceking7498 Před 7 měsíci +1

    THanks dude you are a champ

  • @deepakakshetty9237
    @deepakakshetty9237 Před 8 měsíci +2

    Thank you so much Bro 🥺

  • @emilielaplante119
    @emilielaplante119 Před rokem +1

    What is the maximum distance between the master and slave? I need to separate them 20ft appart and I doubt if that will work. Thank you!

    • @Thetips4you
      @Thetips4you  Před rokem +1

      I too think that is too much. Please check the Arduino specifications.

  • @septimiusx
    @septimiusx Před 3 lety +1

    Thank you!

  • @manuelmatus1212
    @manuelmatus1212 Před 3 lety +2

    why you use digitalRead when you should be using analogRead? You are reading from A0 not from a D pin. No?

    • @Thetips4you
      @Thetips4you  Před 3 lety +1

      A0 can be used as digital pin as well. You can connect the the push button to a different pin if you like, for simple circuit I have used A0.

  • @pecilijevelicanstveni4973

    Hi!
    I am trying to connect two Arduino Mega 2560 via SPI (Master - Slave) and it does not work. I used various examples from internet (most of them are Uno to Uno) but nothing. Please, can you make an example:
    Mega 2560 Master - > SPI -> Mega 2560 Slave
    with the working code and how to do it? I am really in the situation to give up...
    (I am using built-in SPI library but I am not sure that it covers other micros except UNO. Is there be problem with SPI pins?).

    • @Thetips4you
      @Thetips4you  Před rokem

      Need to check on this.

    • @pecilijevelicanstveni4973
      @pecilijevelicanstveni4973 Před rokem

      @@Thetips4you Please, as soon as possible 🙂 (Of course, I am joking. First, enjoy in all holidays!).
      I will wait patiently for the solution.
      Happy New Year!

  • @constantin5413
    @constantin5413 Před 2 lety +1

    Can data be sent vice versa?
    If you can help me with an example please?

  • @Sun_God_26
    @Sun_God_26 Před 22 dny +1

    what if I added one more slave then what will be the change in master unit program

    • @Sun_God_26
      @Sun_God_26 Před 22 dny

      @Thetips4you

    • @Thetips4you
      @Thetips4you  Před 21 dnem

      You need to modify the connections and coding to have one more slave

  • @sardacaseyjess1226
    @sardacaseyjess1226 Před 8 měsíci +3

    wire.h is an invalid header file :(

    • @Thetips4you
      @Thetips4you  Před 8 měsíci +1

      Check your #include wire.h statement and also the model on Arduino you have selected.

    • @yaravk7622
      @yaravk7622 Před 8 měsíci +1

      How? It didn't work for me

    • @sardacaseyjess1226
      @sardacaseyjess1226 Před 8 měsíci

      check the parenthesis@@yaravk7622

  • @MOTRETKITO
    @MOTRETKITO Před 28 dny +1

    i follow your code on thinker cad. but invalid header file .. can you help me

    • @Thetips4you
      @Thetips4you  Před 28 dny

      Check the code properly. You can find the code in my GitHub

    • @c4rto0n49
      @c4rto0n49 Před 23 dny

      @@Thetips4you hes correct i think tinkercad got rid of the library

  • @mehdimbb3622
    @mehdimbb3622 Před 5 měsíci

    Hi
    Why dont use library i2c???

  • @shashankkachouli917
    @shashankkachouli917 Před 5 měsíci

    Why is it showing invalid header file after compilation?

    • @Thetips4you
      @Thetips4you  Před 5 měsíci

      Check the header command or the code is correct

  • @sketter1969
    @sketter1969 Před 3 lety

    very good

  • @sunilminz591
    @sunilminz591 Před rokem

    arduino nano to arduino uno ko led blinking program karen with smartphone

  • @user-sx7li6sx5d
    @user-sx7li6sx5d Před 6 měsíci

    Why does the code just show an error saying invalid header file?

    • @Thetips4you
      @Thetips4you  Před 6 měsíci

      Check the code

    • @user-sx7li6sx5d
      @user-sx7li6sx5d Před 6 měsíci

      The first line is #include and after that the entire code is same.Anyways,will a mistake in the remaining code actually give out such an error?

  • @insanfadhilmaulana8299
    @insanfadhilmaulana8299 Před 7 měsíci

    not work, sangat tidak bermanfaat, membuang-buang waktu

  • @itayadd6391
    @itayadd6391 Před 2 lety

    mmmmmmmmmmmmmmmmmmmmmmmmmmmm

  • @t.n.1056
    @t.n.1056 Před 11 měsíci +1

    After every second sentence, You are saying "okay?" 😮😮 this is Horrible 🤮🤮

    • @Thetips4you
      @Thetips4you  Před 11 měsíci

      Thank you for your feedback.

    • @enea.crazzolara
      @enea.crazzolara Před 6 měsíci +1

      @@Thetips4you That was not horrible, I didnt even notice.

    • @Thetips4you
      @Thetips4you  Před 6 měsíci

      @@enea.crazzolara Thank you for your support.

  • @mothnaalzouabi7121
    @mothnaalzouabi7121 Před 2 lety

    I want to help you with something. How can I contact you privately