Commit b3a4c983 authored by Katie Isard's avatar Katie Isard
Browse files

wk14 ino updated

parent 369a9be3
Pipeline #241964 passed with stage
in 29 seconds
// Wire Master Writer
// Wire Slave Sender
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this
// Sends data as an I2C/TWI slave device
// Refer to the "Wire Master Reader" example for use with this
// Created 29 March 2006
......@@ -13,17 +13,17 @@
#include <Wire.h>
void setup() {
Wire.begin(); // join i2c bus (address optional for master)
Wire.begin(8); // join i2c bus with address #8
Wire.onRequest(requestEvent); // register event
}
byte x = 0;
void loop() {
Wire.beginTransmission(8); // transmit to device #8
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
delay(100);
}
x++;
delay(500);
// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
Wire.write("hello "); // respond with message of 6 bytes
// as expected by master
}
......@@ -356,12 +356,12 @@
<p>
<img src="images/week14/wk14_boards.jpeg" height="500" alt="wk14_boards">
<img src="images/week14/wk14_networking.jpeg" height="500" alt="wk14_networking">
<img src="images/week14/wk14_arduino.jpeg" height="500" alt="wk14_arduino">
</p>
<ul>
<li><a href="files/week14/master_reader/master_reader.ino">master_reader .ino</a> </li>
<li><a href="files/week14/master_writer/master_writer.ino">master_writer .ino</a> </li>
<li><a href="files/week14/slave_sender/slave_sender.ino">slave_sender .ino</a> </li>
</ul>
<p>I am so happy this worked as at the beginning I kept getting an error saying that it couldn't find the correct serial port, I resoldered the wires which then worked as seen! woohoo.</p>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment