Tutorial.MasterReader History

Hide minor edits - Show changes to output

November 16, 2011, at 04:41 AM by Scott Fitzgerald -
Changed lines 40-42 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/master_reader/master_reader.pde lang=arduino tabwidth=4:)

to:
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/master_reader/master_reader.ino lang=arduino tabwidth=4:)

Changed line 44 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/slave_sender/slave_sender.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/slave_sender/slave_sender.ino lang=arduino tabwidth=4:)
September 22, 2010, at 09:22 AM by Christian Cerrito -
Changed line 39 from:
'''Code for Master Reader - Arduino 1'''
to:
'''Code for Master Reader - Program for Arduino 1'''
Changed line 43 from:
'''Code for Slave Sender - Arduino 2'''
to:
'''Code for Slave Sender - Program for Arduino 2'''
September 22, 2010, at 09:07 AM by Christian Cerrito -
September 22, 2010, at 09:05 AM by Christian Cerrito -
September 22, 2010, at 09:05 AM by Christian Cerrito -
Changed lines 5-6 from:
Description
to:
In some situations, it can be helpful to set up two (or more!) Arduino boards to share information with each other. In this example, two Arduinos are programmed to communicate with one another in a Master Reader/Slave Sender configuration via the [[ http://en.wikipedia.org/wiki/I2C | I2C synchronous serial protocol]]. Several functions of Arduino's [[Reference/Wire | ''' Wire Library''']] are used to accomplish this. Arduino 1, the Master, is programmed to request, and then read, 6 bytes of data sent from the uniquely addressed Slave Arduino. Once that message is received, it can then be viewed in the Arduino serial window.

The I2C protocol involves using two wires to send and receive data: a serial clock pin (SCL) that the Arduino pulses at a regular interval, and a serial data pin (SDA) over which data is sent between the two devices. As the clock pulse changes from low to high (known as the rising edge of the clock), a bit of information containing the address of a specific device and a request for data, is transferred from the Arduino to the I2C devices over the SDA line. When the clock pin changes from high to low (the falling edge of the clock), the called upon device transmits it's data back to the Arduino over the same line.

Because the 12C protocol allows for each enabled device to have it's own unique address, and as both master and slave devices to take turns communicating over a single line, it is possible for your Arduino to communicate (in turn) with many devices, or other Arduinos, while using just two pins of your microcontroller.
Changed lines 20-21 from:
Connect pin 4 (the clock, or SCL, pin) and pin 5 (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.
to:
Connect pin 4 (the clock, or SCL, pin) and pin 5 (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 master Arduino must be connected to your computer via USB.
September 22, 2010, at 08:48 AM by Christian Cerrito -
September 22, 2010, at 08:48 AM by Christian Cerrito -
Changed lines 18-19 from:
If powered the Arduinos independently is an issue, the 5V output of the Master Arduino to the VIN pin on the slave.
to:
If powering the Arduinos independently is an issue, connect the 5V output of the Master Arduino to the VIN pin on the slave.
September 22, 2010, at 08:47 AM by Christian Cerrito -
Added lines 16-19:
Connect pin 4 (the clock, or SCL, pin) and pin 5 (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.

If powered the Arduinos independently is an issue, the 5V output of the Master Arduino to the VIN pin on the slave.
Changed line 35 from:
'''Code for Master Reader Arduino'''
to:
'''Code for Master Reader - Arduino 1'''
Changed line 39 from:
'''Code for Slave Sender Arduino'''
to:
'''Code for Slave Sender - Arduino 2'''
September 22, 2010, at 08:35 AM by Christian Cerrito -
Changed line 50 from:
to:
* [[Reference/Wire | Wire Library]]
September 22, 2010, at 08:34 AM by Christian Cerrito -
Changed line 44 from:
* [Reference/WireBegin | @@Wire.begin()@@]]
to:
* [[Reference/WireBegin | @@Wire.begin()@@]]
September 22, 2010, at 08:34 AM by Christian Cerrito -
Changed lines 43-44 from:
* [[Reference/CommandName | Reference page for this command]]
* [[Other example in this category]]
to:

* [Reference/WireBegin | @@Wire.begin()@@]]
* [[Reference/WireRequestFrom | @@Wire.RequestFrom()@@ ]]
* [[Reference/WireReceive | @@Wire.receive()@@]]
* [[Reference/WireSend | @@Wire.send()@@]]
* [[Reference/WireOnRequest | @@Wire.onRequest()@@]]


* [[digital_potentiometer]]
* [[master_writer | Master Writer/Slave Receiver]]



September 22, 2010, at 08:25 AM by Christian Cerrito -
September 22, 2010, at 08:24 AM by Christian Cerrito -
Changed lines 16-17 from:
%height=300px%[[Attach:Master_Sender_bb.png | Attach:Master_Sender_bb.png]]
to:
%height=250px%[[Attach:Master_Sender_bb.png | Attach:Master_Sender_bb.png]]
September 22, 2010, at 08:22 AM by Christian Cerrito -
Changed lines 16-17 from:
%height=300px%[[Attach:ExampleCircuit_bb.png | Attach:ExampleCircuit_bb.png]]
to:
%height=300px%[[Attach:Master_Sender_bb.png | Attach:Master_Sender_bb.png]]
Changed line 24 from:
%height=300px%[[ Attach:ExampleCircuit_sch.png | Attach:ExampleCircuit_sch.png]]
to:
%height=300px%[[ Attach:Master_Sender_sch.png | Attach:Master_Sender_sch.png]]
September 22, 2010, at 07:47 AM by Christian Cerrito -
Changed line 31 from:
'''Code for Master Arduino'''
to:
'''Code for Master Reader Arduino'''
Changed line 35 from:
'''Code for Slave Arduino'''
to:
'''Code for Slave Sender Arduino'''
September 22, 2010, at 07:47 AM by Christian Cerrito -
Changed lines 3-4 from:
!!!Example Name
to:
!!!Master Reader/Slave Sender
Changed lines 9-10 from:
* Arduino Board
to:
* (2) Arduino Boards
* hook-up wire
September 22, 2010, at 07:46 AM by Christian Cerrito -
Changed line 26 from:
Describe what's going on here
to:
!!!Code
Added lines 29-30:

'''Code for Master Arduino'''
Added line 34:
'''Code for Slave Arduino'''
September 22, 2010, at 07:44 AM by Christian Cerrito -
Added lines 30-32:


(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/slave_sender/slave_sender.pde lang=arduino tabwidth=4:)
Changed lines 35-37 from:
to:
(:divend:)

September 17, 2010, at 12:00 AM by Tom Igoe -
Deleted line 0:
Changed line 29 from:
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/master_reader/master_reader.pde language=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/master_reader/master_reader.pde lang=arduino tabwidth=4:)
August 13, 2010, at 10:38 PM by Tom Igoe -
Added lines 1-36:

''Examples > Wire Library''

!!!Example Name

Description

(:div class=BOM :)
!!!Hardware Required
* Arduino Board
(:divend:)

!!!Circuit
(:div class=circuit :)

%height=300px%[[Attach:ExampleCircuit_bb.png | Attach:ExampleCircuit_bb.png]]

[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|Fritzing project page]] -]

(:divend:)

!!!Schematic
(:div class=circuit :)
%height=300px%[[ Attach:ExampleCircuit_sch.png | Attach:ExampleCircuit_sch.png]]
(:divend:)

Describe what's going on here

(:div class=code :)
(:source http://arduino.cc/en/pub/code/master/libraries/Wire/examples/master_reader/master_reader.pde language=arduino tabwidth=4:)
(:divend:)


!!!See Also:
* [[Reference/CommandName | Reference page for this command]]
* [[Other example in this category]]

Share