I2c communication between 2 Arduinos

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
User avatar
Emadex3
Posts: 9
Joined: Sat Apr 28, 2018 7:43 pm
Location: Home
Has thanked: 5 times
Contact:

I2c communication between 2 Arduinos

Post by Emadex3 »

I need some help with with I2c communication between two micro-controllers (Atmega 2560) lets call them "Arduino 1" and " Arduino 2 "

Due to"reasons" Arduino 1 will be programmed with flowcode however , "Arduino 2" has to be programmed using Arduino IDE.

I want to send multiple variables values from "Arduino 1" to "Arduino 2" using I2c (sda/scl pins) <all kind of sensors and outputs connected to arduino 1>

how can I do it ? , any kind soul out there can help me please :mrgreen:

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: I2c communication between 2 Arduinos

Post by Benj »

Hello,

Which device will be programmed with Flowcode? The master or the slave?

We have some helpful info on I2C available here.
https://www.matrixtsl.com/blog/simplifi ... c-and-spi/

I have created SPI slave devices in the past and use finite state machines to help perform the comms protocol.
https://www.flowcode.co.uk/wiki/index.p ... ateMachine

User avatar
Emadex3
Posts: 9
Joined: Sat Apr 28, 2018 7:43 pm
Location: Home
Has thanked: 5 times
Contact:

Re: I2c communication between 2 Arduinos

Post by Emadex3 »

Thanks for your attention even though you seem busy :D

The master will be programmed using flowcode .

what I am trying to accomplish is to send a variable's value from one Arduino (Master) to another (slave).

I've seen the examples in the wiki and honestly I don't quite understand the send,recieve procedure, the value being sent is a whole port state while I need to send either individual bits or pull variable values from where ever they are stored and send them while being able to receive each variable value separately


sorry for any inconvenience I've caused and Thanks for your reply. :mrgreen:

here's my poor attempt at i2c communication using 2 Arduino Mega (Both programmed with flowcode, need to know how it works here first :shock: )
Attachments
slave22.fcfx
(11.12 KiB) Downloaded 166 times
Master.fcfx
(11 KiB) Downloaded 159 times

Post Reply