![]() I have chosen the 6-axis gyroscope and accelerometer module MPU6050 as a demonstration object. However, to understand the differences between TinyWireM and Wire, let’s now look at an example where we don’t use a component library. In most cases you probably use libraries for I2C devices which do it for you to address the devices on register level using the wire functions. Pinout ATtiny85 / 45 / 25 Using TinyWireM and Wire for the MPU6050 Otherwise, it will be too small for some examples. However, it should be a model with 8 kByte program memory. You can just as well take another ATtiny which is compatible with ATTin圜ore. Alternatively, you can download the library directly from GitHub here.įor this article, I use an ATtiny85. You can get the library via the library manager of the Arduino IDE. You should as well have TinyWireM installed. If that’s not the case, just check out my last post, where I explained it all in detail. I also assume you know how to burn bootloaders and upload sketches with it. I assume that you have installed the ATTin圜ore package from Spence Konde. I will confine myself here to the use of the ATtinys as masters in this post. For example, if you wanted two ATtinys to communicate with each other via I2C, you would need both variants. For the latter, there are several other libraries like TinyWireS. ![]() That means the library allows to make the ATtiny the I2C master, but not the slave. And finally, I show with two examples that you can modify many I2C based libraries to make them compatible with TinyWireM without much effort. I also introduce TinyWireM compatible libraries for some I2C based devices. ![]() ![]() In this article, I use Adafruit’s TinyWireM library as an example to explore how big the savings are compared to Wire. However, since they are leaner, their use on the ATtinys with their limited program memory can still be useful. Special libraries for the I2C implementation, such as TinyWireM, TinyI2C or USIWire are thus no longer needed. ![]() This package allows using the USI interface of the ATtinys for I2C use with the Wire library. In the last post I had reported about programming ATtinys with ATTin圜ore. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |