Questions tagged [wire-library]

Use this tag for the Wire library, used for I2C/TWI communication.

Filter by
Sorted by
Tagged with
7
votes
5answers
12k views

Alternatives to Wire library for I2C

I am looking for (reasonably easy to use and well tested) alternatives to the Wire library. Wire works very well, but: I only need the Arduino to act as I2C master and the Wire library seems to be a ...
7
votes
2answers
11k views

How to choose alternate I2C pins on ESP32?

I'm a begginer with Arduino and this may be a basic question but I'm facing an issue. I'm using a HTU21D sensor with an ESP32. This sensor use I2C communication. Inside the Arduino library, there is ...
7
votes
2answers
53k views

Sending and receiving different types of data via I2C in Arduino

I have found a few good tutorials on how to send and receive data via I2C in connected arduinos. My limitation is now how to transmit different types of data like for instance, long, float, etc. Right ...
6
votes
2answers
8k views

Wire.h not found!

Here's the code that's making this error: #include "Wire.h" Here's the error: fatal error: Wire.h: No such file or directory #include "Wire.h" ^ compilation terminated. Error ...
5
votes
2answers
4k views

Which library to choose? <Wire.h> or “Wire.h”?

I know that in C++, to include a library, you either put the library name in <x> or "x". Now, I believe that this was because of a major change in the C++ language a some time ago. Now, in ...
3
votes
3answers
2k views

I2C Wire.write function doesn't seem to work

Using the simplest code possible to test the library: #include <Wire.h> void setup() { Wire.begin(); // join i2c bus Wire.beginTransmission(44); // transmit to device #44 (0x2c) ...
3
votes
1answer
230 views

Undefined functions send() and receive() on TwoWire/SPI

I have downloaded a sketch that uses SPI. The sketch includes the Wire library but at compilation time, I am getting errors that TwoWire doesn't have methods called send() and receive()?
3
votes
2answers
531 views

Arduino Master-Slave Pins

Can I change the pins on the communication for a Master-Slave arduino Wire transmission? I want to communicate between 2 arduinos, but on one of them A4&A5 are taken
3
votes
2answers
941 views

Replace Wire library with TinyWireM

I want to integrate Pololu's vl53l0x Time of Flight distance sensor into a project of mine. They created a library to interface with the vl53l0x over I2C, which works great on my Uno. The only problem ...
3
votes
2answers
1k views

Wire Library send/receive

I'm doing a project that includes an Arduino Uno and custom hardware made by me. Everything is working perfectly independently, and I'm trying to implement a way for them (the Arduino and my hardware) ...
2
votes
1answer
3k views

Wire.h library works on Uno but won't compile for ATtiny85

TL;DR: Arduinos are current hungry so I want to switch my microcontroller code works on Uno, I change upload to ATtiny85, code doesn't compile Wire.h breaks at the TWBR input Should I keep trying to ...
2
votes
2answers
851 views

Arduino Wire.h send double to lcd

I'd like the double number 200.00 shown as 200.00 on my LCD screen. For instance, when I pass just a number (int) like 40 to the LCD, it uses it as an ASCII code to show a character on the display. ...
2
votes
1answer
727 views

wire.h multiple slave addresses

Is it possible to use wire.h on an Arduino Uno to act as a slave for more than one address? For example I'd like it to emulate two different devices, one at I2C address 23 and the other at address 57....
2
votes
1answer
445 views

I2C communication between Arduino Due and Nano

I'm trying to communicate between two Arduino Due and Nano. Nano as Master and Due as a slave. As given in the library description Wire Lib When the master request for data from the slave, first it ...
2
votes
1answer
201 views

Function not successfully reading sensor registers

I'm trying to write a library for an accelerometer/magnetometer sensor. The sensor is a LSM303D chip (https://www.pololu.com/file/0J703/LSM303D.pdf). I've written a function, readRegister() (below) ...
2
votes
2answers
1k views

Arduino I2C via USB Serial cable? [closed]

An Arduino UNO is given. I want to establish an I2C communication channel between Arduino UNO and a Linux Machine which have only USB ports available to communicate with peripherals. Currently I can ...
1
vote
2answers
409 views

Arduino I2C Wire.onReceive hangs after a few loops

I have an Arduino Leonardo (master) and a Polulu A-star 328 PB(slave). I intend to use the slave to actuate some servos. I've modified the code from https://www.arduino.cc/en/Tutorial/MasterWriter to ...
1
vote
2answers
585 views

I2C between Arduinos without Master

I am working on a library for some Arduinos that should talk between each other. The aim is that I can load the same binaries onto each Arduino. The I2C ID will be set by DipSwitches. So far ...
1
vote
2answers
1k views

I2C from two masters (ATtiny85, ESP8266) to one slave (ATmega328)

I've been working on a project with I2C protocol where an ATmega328 (Arduino) configured as slave, receives messages from an ATtiny (ATtiny85, ATTinyCore by SpenceKonde) configured as master, or from ...
1
vote
2answers
130 views

Update Variable via Arduino to Arduino I2C

I am attempting to send a simple 1 byte value from one arduino to another using I2C with the Wire library. From reading I see that this is typically done using the event monitor supplied by the Wire ...
1
vote
1answer
95 views

Wire.h missing - Failing to upload I2C 16x2 LCD sketch

I am total newbie in Arduino and for the last 3 days I am trying to figure this out. I would like to use an I2C display for a project. I have installed the LiquidCrystal_I2C, but when I try to upload ...
1
vote
1answer
531 views

Why can't I include a library in another one?

I am trying to create a new library that uses another existing library. The original library declares a way to create an object called Multiserial that can be created in the main file and the program ...
1
vote
1answer
147 views

Working with Wire core library

I'm studying the Wire library code driver utility/twi.h to learn how twi buffering and ISR management work. What I did actually, is that I copied the header/source files from the Arduino path F:\...
1
vote
1answer
691 views

How to avoid calling multiple times Wire.begin() in libraries?

it's all in the title ; I'm developping a library and use *TwoWire pointers in this library ; but I am using an external library that calls Wire.begin(). I've seen something about TWCR register in ...
1
vote
1answer
2k views

How can Arduino know Wire.available() is true or false?

In this part of code void readFrom(byte device, byte fromAddress, int num, byte result[]) { Wire.beginTransmission(device); Wire.write(fromAddress); Wire.endTransmission(); Wire.requestFrom((...
1
vote
1answer
839 views

I2C wire.h send 2 variables

I am trying to send 2 variables with wire.h. I tried with this code: MASTER RECEIVER: #include <Wire.h> // include la libreria #include <LiquidCrystal_I2C.h> #include "RTClib.h" ...
1
vote
3answers
584 views

wire.h onReceive only triggering once

I am writing a program to emulate a LCD driver chip (PCF8576) in a piece of equipment where I need to replace an unobtainable LCD display. I have wire.h set up and the code in place to decode chip ...
1
vote
3answers
973 views

Arduino Wire.h library: how to communicate with an LCD?

I am having an Arduino Uno and a C2042A LCD with I2C shield on it. Because the VirtualWire library does not work for me. I tried only the wire library but it's still not working: My code: #include &...
1
vote
1answer
162 views

Arduino Uno Wire Transmission Issues

I am developing code to run a word clock and have noticed a slight problem. I am using a DS3231 to keep time, and using the Wire library to communicate with it. I ping the DS3231 every second to get ...
1
vote
1answer
391 views

Modifying Arduino IMU library to rely on DSSCircuit's I2C Master Library

For an Arduino project I am working on, I am trying to modify the SparkFun 6 Degrees of Freedom IMU Digital Combo Board - ITG3200/ADXL345 to support DSSCircuit's I2C Master Library (https://github.com/...
1
vote
2answers
519 views

Switch MPU6050 to send SCL data through A4 and SDA through A5

I have this MPU6050, and like most of the other MPU6050s, it is set up for SCL to be attached to A4 and SDA to be attached to A5. I have this shield on my Arduino Uno, which is configured for ...
1
vote
2answers
4k views

Arduino Uno (master) and ATTiny85 (slave) I2C connection not working

I am trying to send and receive data using I2C between an Arduino Uno and an ATTiny85. The Arduino Uno is using the Wire library. The ATTiny85 is using the TinyWire library and is programmed (and ...
1
vote
1answer
641 views

I2C hookup - sketch just crashes

I am encountering problems with I2C when trying to attach a 9DoF Sensor to my Arduino Uno. Following these instructions (the hardware setup I have is like in the schematic) I noticed the basic example ...
1
vote
0answers
60 views

Can't get MMC3416xPJ to work

I needed a magnetometer with a high Output Data Rate (ODR). This is because I wanted to measure AC magnetic fields of around 20-80 Hz. So I decided to go with the MMC3416xPJ prototyping board which ...
1
vote
1answer
500 views

Communicating with I2C DAC (LTC2631)

Firstly, let me say that I'm new to using I2C devices, especially with Arduino. I have an 8-bit DAC (LTC2631) that I'm trying to control with an Arduino Uno. I thought I would be able to use the ...
1
vote
0answers
238 views

I2C between Yun Shield (Dragino) and UNO R3 problem

I am having problems with I2C communications between my Dragino Yun and an Arduino UNO R3. I can have the Dragino request data (using Wire.onRequest on UNO) from the UNO and it works great, however, ...
1
vote
0answers
1k views

How to prevent Wire.requestFrom from hanging?

I'm trying to read data from an Arduino Uno I2C slave via Wire.requestFrom() on an Arduino Uno master. The slave's onRequest handler is simply: void I2C_Send() { byte myArray[4]; myArray[0] = ...
1
vote
0answers
181 views

Too many Bytes Using Ultrasonic Sensors

I need to send one transmission and record multiple distances with 4 receivers, but everytime I use more than 2 receivers, the serial data does not print. What can I do? P.S. I'm using 5 SRF-02 ...
1
vote
0answers
86 views

GPRS and Weather Shields

I have GPRS(GPRS_Shield_V1.0), weather shield and arduino uno R3. When I use Arduino and GPRS it works perfectly and when I used Weather Shield it also worked perfectly. But weather shield needs wire ...
0
votes
2answers
57 views

Questions about HMC5883L library

I'm studying the structures of libraries currently. I want to learn how good programmers write code, what are the strategies they follow, the art the programmer followed to develop the library. And ...
0
votes
1answer
454 views

TWI Wire.setClock() on non arduino AVR MCU issue

Using an Atmega168P - programmed by means of avrdude with the .hex file generated by Arduino IDE. The following code sets the 8 MHz Atmega's TWI interface to just 15.625 kHz: Wire.begin(); // ...
0
votes
1answer
941 views

Issues with I2C and Wire.Available()

I am working on a project which requires communication from an Arduino Due (Master) and an FDC2214Q1 C to D IC (Slave), but there is some variability as to whether the code works or not depending on ...
0
votes
2answers
1k views

I2C call during Wire.requestFrom

Which I2C command happen during Wire.requestFrom(address, quantity)? Is it correct that Wire put a Start condition, then 7-bit address appended with read bit? How would that be different from Wire....
0
votes
1answer
2k views

Reading values from TTP229 capacitive touch sensor on arduino

I would like to be able to read the raw capacitive sensor values from a TTP229 chip through i2c in Arduino. I have one of these breakout boards to play with : My goal is to get values similar to ...
0
votes
1answer
71 views

Plant irrigation system

I'm very new to the Arduino game I wanted to make a small auto watering system for my plants. I bought these items 5V 1 CHANNEL RELAY MODULE FOR ARDUINO PIC AVR DSP ARMB 9 VOLT BATTERY SNAP ...
0
votes
1answer
176 views

Sending more than BUFFER_LENGTH(32) bytes in slave answer I2C

I need to send 259 bytes as answer to I2C master read request. AFAIK there is a buffer limit of 32 bytes in Wire.h and in HW (Arduino Nano). Is there a way sending 259 byte answer, or I have to choose ...
0
votes
1answer
149 views

I2C Wire.onRequest not detected

I want to know why Wire.onRequest can not detect below massage and what I can do to detect it.(I am not able to change I2C massage) I was able to read this part of the massage with wire.onReceive: ...
0
votes
1answer
43 views

Wire SlaveReceiver : will the registered function in onRecieve interrupt/conflict with loop block?

I am currently researching on I2C, and I made a configuration that has MasterWriter that transmits data to a SlaveReceiver that will store the data received from Master, into an SD card, and then ...
0
votes
2answers
104 views

Sharing serial output from one to many arduinos (plus a computer) via USB hub

I am trying to send rotary encoder output from an UNO to seven Trinket M0s and a computer via a (powered) USB hub. Currently the UNO → Laptop bit works great, serial monitoring works via the hub ...
0
votes
1answer
352 views

Why does my 16x2 LCD displays weird letters and can't insert key from keypad?

I'm a newbie on Arduino here, and this is my first project on 16x2 LCD, 4x4 keypad and others. So, the story is, after I uploaded the program for my group's Arduino alarm clock to the Arduino board, ...