$30 off During Our Annual Pro Sale. View Details »

Kotlin with IoT Applications

Toan Tran
December 17, 2019

Kotlin with IoT Applications

Kotlin is warm welcomed by the Android world. But is that the only use-case Kotlin can help? This presentation brings the trial of Kotlin to the IoT world by working on a prototype device called CI Lighthouse.

Toan Tran

December 17, 2019
Tweet

More Decks by Toan Tran

Other Decks in Programming

Transcript

  1. HCMC KOTLIN USER GROUP
    MEETUP – 17TH DEC 2019

    View Slide

  2. ABOUT
    SPEAKER

    View Slide

  3. KOTLIN WITH IOT APPLICATIONS
    • Popular use case of Kotlin for Android app development
    • Extended use case to have Kotlin run on Backend, just like Java language based
    on JVM
    • What else?
    KOTLIN WITH IOT APPLICATIONS
    • Popular use case of Kotlin for Android app development
    • Extended use case to have Kotlin run on Backend, just like Java language based
    on JVM
    • What else?

    View Slide

  4. DISCLAIMER

    View Slide

  5. KOTLIN
    NATIVE
    How about having
    Kotlin to run on device
    like Raspberry Pi?

    View Slide

  6. NOT KOTLIN
    NATIVE

    View Slide

  7. WITH KOTLIN NATIVE
    Kotlin
    Source
    Code
    Kotlin/Native
    Compiler
    Intermediate
    Representation
    LLVM
    BINARY
    0100101..
    Frontend Backend

    View Slide

  8. WHAT TO
    BUILD?
    • A lighthouse device.
    • Read the status of CI pipeline.
    • Display the CI status of trunk
    branch: GREEN (passed),
    YELLOW (running) and RED
    (failed).
    Example for Build light indicator

    View Slide

  9. LET’S DO
    THIS

    View Slide

  10. TERMS
    konanc: Kotlin/Native
    compiler
    cinterop: Kotlin/native
    interoperability – create
    Kotlin binding for native lib
    armhf: Raspberry PI 3 B
    model architecture

    View Slide

  11. RUN THE APP

    View Slide

  12. VERIFY

    View Slide

  13. CROSS-
    PLATFORM
    COMPILING

    View Slide

  14. CROSS-
    PLATFORM
    COMPILING

    View Slide

  15. RUN ON THE PI

    View Slide

  16. MANIPULATE
    THE
    HARDWARE

    View Slide

  17. WHAT I HAVE
    LEARNED
    You need to learn a bit
    about hardware along the
    way
    Not so much tutorials on
    this topic yet
    Controlled experiment

    View Slide