Bird
0
0
Arduinoprogramming~5 mins

Wire library for I2C in Arduino - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the Wire library used for in Arduino?
The Wire library is used to communicate with devices using the I2C protocol, allowing the Arduino to act as a master or slave on the I2C bus.
Click to reveal answer
beginner
How do you start the I2C communication as a master using the Wire library?
You call Wire.begin(); in the setup() function to start the I2C bus as a master.
Click to reveal answer
beginner
Which function is used to send data to a device on the I2C bus?
Use Wire.write() to send bytes of data to the device after starting a transmission with Wire.beginTransmission(address).
Click to reveal answer
beginner
How do you request data from a device using the Wire library?
Use Wire.requestFrom(address, quantity) to ask a device for data, then read it with Wire.read().
Click to reveal answer
beginner
What is the purpose of Wire.endTransmission()?
It ends the transmission to the I2C device and actually sends the data over the bus.
Click to reveal answer
Which function initializes the I2C bus as a master in Arduino?
AWire.begin()
BWire.start()
CWire.init()
DWire.open()
How do you send data to a device with address 0x3C using the Wire library?
AWire.send(0x3C, data);
BWire.write(0x3C, data);
CWire.transmit(0x3C, data);
DWire.beginTransmission(0x3C); Wire.write(data); Wire.endTransmission();
Which function reads a byte from the I2C device after requesting data?
AWire.get()
BWire.read()
CWire.receive()
DWire.fetch()
What does Wire.requestFrom(address, quantity) do?
ACloses the connection to the device at 'address'
BSends 'quantity' bytes to the device at 'address'
CRequests 'quantity' bytes from the device at 'address'
DStarts transmission to the device at 'address'
Which of these is NOT a typical step in sending data with Wire library?
AWire.receive()
BWire.write()
CWire.endTransmission()
DWire.beginTransmission()
Explain the basic steps to send data to an I2C device using the Wire library.
Think about starting, writing, and ending the communication.
You got /3 concepts.
    Describe how to read data from an I2C device using the Wire library.
    Request first, then read the data.
    You got /3 concepts.