![]() ![]() Luckily, as Android Things is basically Android and most of Android APIs work just well, it's easy to manipulate bitmap an dump it to the screen. Everything you want to display on it should be drawn as bitmap. ![]() However, apparently the driver doesn't provide API for writing text just like what you'll find in Arduino libraries. As mentioned, there's also user driver for it so I can just use it. I don't need to create listener inner classes to handle callbacks, like I will do if using Java.ĭisplaying sensor reading is done using SSD1306-based OLED screen. MSensorManager.registerDynamicSensorCallback(dynCb) To instantiate and register BMP280 user driver, we need these lines: try, sensor, SensorManager.SENSOR_DELAY_NORMAL) The main entry to the app is SensorActivity.kt file. In order to use User Driver for both BMP280 and SSD1306, we need to make entry in app level adle compile '.contrib:driver-bmx280:+'Ĭompile '.contrib:driver-ssd1306:+' It happens that Google is nice enough to make User Driver for both BMP280 and SSD1306 modules. In Android Things, there's a concept called User Driver, which are the components registered from within apps that extend existing Android framework services. This video shows how the final result will look like:Īs both modules are accessible via I2C protocol, I need to know how to work with I2C in Android Things.įurther exploring it, turned out I don't need to go down to I2C level, reading and writing registers by myself. This project has simple objective to read temperature and pressure from BMP280 sensor and display the reading to OLED display. It's very hard to learn new technologies without objective, so this project is my objective to learn Kotlin. I don't say Kotlin copies Swift or vice versa, I just happen to know Swift first. Turns out both languages share similar syntax. ![]() I have a bonus already having experience with Swift programming language, you know, the one that you can use to develop app for Apple platforms. It turns out, Kotlin is very easy to learn. So, this project is my first attempt to use Kotlin. So, to learn developing for Android Things, I think it will be a good opportunity to also learn Kotlin. Actually, it's been around since 2011, but made popular lately, especially after Google announced to officially use it for developing for Android. Luckily, there's a new kid on the block, Kotlin. But my love to it became less and less lately due to its nature and new languages came along. I've also been using Java for developing Android apps since 4 years ago. I have no issue with Java, I acquired Java skill since 18 years ago, working on my under-graduated project with it, and it will always be a part of my life. Last Jul 22, I had the opportunity to share about Android Things development in a event called Google I/O Extended Jakarta - Indonesia.īut developing for Android, and also Android Things, requires us to use Java (you can always use C++ with NDK, but that's not for mere-mortals. Personally, I'm happy with Google's direction to take on Internet of Things.Īs an IoT influencer and maker in Indonesia, I need to learn and share it to the community. ![]() Imagine that you can leverage your existing Android programming skills acquired for many years, to develop an app for Internet of Things. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |