Sohrab 1 Posted June 29, 2021 How can I access GPIO pins on android 10 without root access? I have a 2s tinker board and I want to access serial pins. Thank you in advance 1 Share this post Link to post Share on other sites
yi-hsin_hung 3 Posted June 1, 2022 Hi @Sohrab: Please reference the following wiki for Tinker Board 2 (RK3399) mraa library on Android. https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide#mraa-library-for-android 1 Share this post Link to post Share on other sites
hisataro 0 Posted June 9, 2022 Hello @yi-hsin_hung I want to use the mraa library in Unity, can you tell me the package name? ex unity C# code) AndroidJavaObject _javaClass = new AndroidJavaObject ("com.tinkerboard.mraa"); Share this post Link to post Share on other sites
hisataro 0 Posted June 9, 2022 Hello @yi-hsin_hung I want to use the mraa library in Unity, can you tell me the class name? ex unity C# code) AndroidJavaObject _javaClass = new AndroidJavaObject ("com.tinkerboard.mraa"); ? Share this post Link to post Share on other sites
yi-hsin_hung 3 Posted June 13, 2022 Hi @hisataro: Have a nice day! The mraa android library can be included by the following code on Android studio and we didn't support C# at current. import mraa.*; Thank a lot! Share this post Link to post Share on other sites
hisataro 0 Posted June 13, 2022 Hi @yi-hsin_hung It worked by using mraa-2.0.0.aar directly from Unity ! // Put aar to Unity Plugin Folder UnityProjectFolder/Assets/Plugin/Android/mraa-2.0.0.aar // Gpio Instance AndroidJavaClass _TinkerBoard = new AndroidJavaClass("mraa.TinkerBoard"); AndroidJavaObject _TINKERBOARD_PIN3 = _TinkerBoard.GetStatic<AndroidJavaObject>("TINKERBOARD_PIN3"); int swigValue = _TINKERBOARD_PIN3.Call<int>("swigValue"); AndroidJavaObject _Gpio = new AndroidJavaObject("mraa.Gpio", swigValue); // Dir instance AndroidJavaClass _Dir = new AndroidJavaClass("mraa.Dir"); AndroidJavaObject _DIR_IN = _Dir.GetStatic<AndroidJavaObject>("DIR_IN"); // Mode Instance AndroidJavaClass _Mode = new AndroidJavaClass("mraa.Mode"); AndroidJavaObject _MODE_PULLUP = _Mode.GetStatic<AndroidJavaObject>("MODE_PULLUP"); // Call Gpio.read() AndroidJavaObject resultDir = null; AndroidJavaObject resultMode = null; resultDir = _Gpio.Call<AndroidJavaObject>("dir", _DIR_IN); resultMode = _Gpio.Call<AndroidJavaObject>("mode", _MODE_PULLUP); int result = _Gpio.Call<int>("read"); Tahnk you. Share this post Link to post Share on other sites
yi-hsin_hung 3 Posted June 14, 2022 Hi @hisataro: Good news about this. It's a good experience for us. Thanks! Share this post Link to post Share on other sites
Turtley 0 Posted February 2, 2023 Hi @yi-hsin_hung, how can I add mraa library to Android studio? When I typed import mraa.* it said "Unresolved reference: mraa" Share this post Link to post Share on other sites
yi-hsin_hung 3 Posted February 2, 2023 Hi @Turtley: Please reference the https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide#mraa-library-for-android Thank a lot! Share this post Link to post Share on other sites
Turtley 0 Posted February 2, 2023 Hi @yi-hsin_hung: Thanks for your reply! I read that before and got the mraa.aar file but didn't know how to make it Android studio library. I've jut tried to put that file into app/libs then add the libs folder to the dependencies and it seems work Share this post Link to post Share on other sites