Hello everyone. Anyone here work with kotlin + ras...
# embedded-kotlin
f
Hello everyone. Anyone here work with kotlin + raspberry pi???
d
Sure, any standard Raspberry Pi from 1 thru 4 is easy, they're a relatively powerful ARM SoC running Raspberry Pi OS, a derivative of Debian Linux, so install a JVM + kotlin packages and off you go.
Now the Pico on the other hand... a man can dream ☺️
f
@darkmoon_uk nice. Are you able to handler GPIO too with Kotlin??
d
Yes if you decide to use Kotlin/JVM on the Raspberry Pi then check out Pi4J
Or you could use Kotlin/Native with the WiringPi library
Depends on your application but in most cases I would recommend going the JVM route; it's better supported by tooling at present.
f
Ok Chris, thank you for recommending that libraries. I am check out the Pi4J for now.
Do you use some remote service to access your raspberries???
d
SSH mostly, for controlling the Pi manually by terminal
If your GPIO control is for something like home automation or doesn't have strict timing requirements I would consider incorporating something like an MQTT protocol library which gives you an easy publish/subscribe thing over the network
f
ok, I also use SSH for controlling the Pi on local network. Do you also use SSH for external network???
d
I don't have that requirement, but seems reasonable to use it that way.
f
Hello Chris. The Pi has one UART interface, right? Do you know if it is possible adding sofware serial just like arduino????
d
You can certainly access the UART on the Pin header, that's exposed as a standard Linux device either
/dev/ttyAMA0
(Pi 1, 2, 3a) or
/dev/ttyS0
(Pi 3b, 4?) depending on the model of Pi.
If you mean to implement multiple UARTs via software control of the GPIO pins (aka bit-banging), then this may be more of a challenge on the Pi due to the operating system 'getting in the way'. Linux isn't a real-time operating system meaning it doesn't guarantee when operations will be scheduled; and implementing a UART has strict timing requirements.
You might be able to get away with lower baud rates in case you just want an extra port for some light logging/monitoring. But if having multiple ports is critical to your Application and you're determined to use the Pi as the basis for your project for other reasons; then one possibility is to connect a standard Arduino (Atmel Atmega328P) to the Pi via I2C, and then write a small amount of software on both the Pi and Arduino to route messages via I2C, to either of the two hardware UARTS implemented on the Atmel. That would give you three hardware-managed Serial ports.