New answers tagged

0

The BMA421 was not locked. An erroneous write to the wrong register had switched it to the (non-existant) SPI interface. The solution was to power cycle the sensor.


0

You probably need to use LIDARLite_v3HP.h. The setI2Caddr() function is not same between LIDARLite_v3HP.h and LIDARLite.h. The datasheet you provided, has the instruction on how to update the I2C address. LIDARLite_v3HP.h's setI2Caddr() followed those instructions. To check, if you go to this line of the source code of LIDARLite.h, you will see the function ...


8

Important information: Wire.write() does NOT send anything over the I2C lines. It just puts the data into the libraries internal buffer. The actual transmission is then done by Wire.endTransmission(). I2C is packaged transmission protocol. That means, that the transmission is done in confined data packages. In your master code you are calling Wire.write() ...


1

Thank you Majenko... It was low RAM problem. SSD1306 takes 1K, with MPU6050 the and serial print which I have included the remaining RAM is 5 bytes only, hence the initialization issue. I followed simple guideline to reduce RAM footprint Read this thread https://stackoverflow.com/questions/8649174/checking-memory-footprint-in-arduino Code to print available ...


1

The following code shows, how I would read from a STC3100. But I own none of them, so I can not try the code. I would be very surprised if it works directly. Use it as an example. Perhaps we could improve it together. ;-) #include <Wire.h> #define STC_ADDRESS 0x70 #define MODE_REGISTER 0x00 #define CURRENT_LOW_REGISTER 0x06 #define ...


3

The SSD1306 uses a lot of RAM. Pretty much all your RAM. Serial also uses quite a bit of RAM. The two struggle to work together. There is a special "text only" SSD1306 library that uses considerably less RAM: https://github.com/greiman/SSD1306Ascii


3

The Wire library does not give you any possibility to get error states, when requesting bytes from a slave. Basically you are stuck with the number of bytes being read. Though you can read some information from that. If the number of bytes is zero, the slave didn't answer (either because its not there, or because it cannot send any byte currently). This ...


0

The TTGO TS uses an ST7735 display. This is not an I2C device. Instead it uses its own custom serial protocol. Since the DC pin is broken out for you it uses the 4-wire serial interface which is simplest to use with SPI. It's confusing that they use the terms SCL and SDA, which makes you think it's I2C, but it's not.


0

Like @romkey said, use a I²C scanner to find the address of the device, for example this one from the Arduino website. Connect the device to the Arduino board, upload the code and look up the I²C address of your device.


2

Sorry if I'm late to the party. I solved this years ago. Here's my YT video demo with a google drive link to the code in the video description. It works with the entire SM58XX series of sensors. Just input the parameters for your particular model in the top lines of the code and you'll be off to the races. https://www.youtube.com/watch?v=Xb2J1puSOwk


1

Generally you should not provide power to any pin of a device, which is powered off. That can cause current flowing through clamping diodes to ground and might destroy the pins hardware or the device (also it can lead to weird situations, where the device is somewhat powered through the IO pin, which might lead to instability). You can either cut the ...


2

Reading and writing of serial data are separate functions. When you .write() you just append the data to the TX buffer. When you .read() you just take the next character from the RX buffer. All actual sending and receiving, and filling/emptying of the buffers is done inside the ISRs for the UART module. That said, you really shouldn't use Serial inside an ...


1

Thank you for the answers, however, I am still confused as some sample codes included in the Arduino IDE do not have wire.setClock(), how can it work for I2C communication. for example: I2C SRF10 or SRF08 Devantech Ultrasonic Ranger Finder #include <Wire.h> void setup() { Wire.begin(); // join i2c bus (address optional for master) Serial....


0

Serial.begin starts the communication on USB or RX/TX pins. It has nothing to do with Wire library and I2C communication. I2C clock speed determines the speed of communication on the I2C bus. Wire.begin() among other settings, sets the I2C clock speed to some default value. Wire.setClock() allows to set a different clock speed. This should be supported by ...


3

Serial has nothing to do with Wire/I2C communication. The examples only have this, because mostly they use Serial out- and input for interaction in the example codes (like showing the data of an I2C sensor on the Serial Monitor). If you don't want to use the Serial Montior/Serial communication, then you can leave all the calls to Serial out.


Top 50 recent answers are included