Java ME 8 + Raspberry Pi + Accelerometer + PWM + Motor Driver = JBalancePI Robot (Part 1)

Learn how to build a two-wheel self-balancing Java robot using Raspberry Pi. In my last four-part series of articles, I explained how to connect electronic sensors or devices to the Raspberry Pi 2 Model B using various interfaces: Part 1 showed how to use general-purpose input/output (GPIO) interfaces, Part 2 used inter-integrated circuit bus (I2C) interfaces, Part 3 used universal asynchronous receiver transmitter circuit (UART) interfaces, and Part 4 used serial peripheral interface (SPI) interfaces.”

Link