Tutorial How control GPIO whith Android Studio App on Orange Pi 3g and 4g Iot 看全部

Edited by cadinodod at 2021-6-17 03:56

Tutorial How control GPIO whith Android Studio App on Orange Pi 3g and 4g Iot

In this tutorial I will show how control GPIO on Orange Pi 3g Iot and Orange pi 4g Iot using Android Studio app .
First you must have full root access, check this post:  Full root access on Orange Pi 3g Iot and Orange Pi 4g Iot

Prerequisites:
     1. Android Studio already installed
     2. An Orange Pi 3g Iot or Orange pi 4g
     3. Jummpers, resistor and Led

Step 1:
1. Creat a Android Studio new project

Step 2:
1. Download the library OrangePi3g4gIot Android

Step 3:
1. Import OrangePi3g4gIotGPIO. Check this post

How use:

  1. /*To toogle a output gpio*/
  2. final DigitalWrite digitalWrite = new DigitalWrite(); //create a gpio output object
  3. digitalWrite.Set(GPIO.GPIO_141_HIGH); // set the state of GPIO141 to HIGH
  4. digitalWrite.Set(GPIO.GPIO_141_LOW); // set the state of GPIO141 to LOW


  5. /* for read gpio*/
  6. final DigitalRead digitalRead = new DigitalRead(GPIO.GPIO_144, GPIO.EN, GPIO.PULLDOWN); //create a gpio input; object the must be have the gpio number, the pull enable (GPIO.EN) and the pull (GPIO.PULLDOWN or GPIO.PULLUP)
  7. digitalRead.getValue() //read the value of GPIO object created ealiry. It is a integer and can be 0 ou 1

Code:
Download code

Demo:
Demo Video
Demo Video 2
Demo video 3
Edited by Kingdom at 2021-11-30 13:11

Hello, I have some questions about your GPIO project for Orange Pi4g iot

1. I have troubles with import your module to Blank Activity project and final sync/build, because multidex  2 (Google maven) repository is not present in my Android  SDK manager for install - Chipmunk Studio 2021.2.1. Canary 5

2. How can I find info about GPIO resources of OrangePi4, not iot version, to make the adaptation of your module for my Opi4 board?
Official page:
http://www.orangepi.org/Orange%20Pi%204/
Hello again, first issue I fixed myself  due to this article

https://developer.android.google ... dex?hl=en-GB#groovy

Still searchin Opi4 GPIO reference
quote: Kingdom replied at 2021-11-30 17:58
Hello, I have some questions about your GPIO project for Orange Pi4g iot

1. I have troubles with im ...

Hi

I thing in this link: http://www.orangepi.org/download ... 39f316305414ee.html

I hope this can help you

Thanks for sharing, It was indeed very impressive. Keep sharing stuff like this in future. Also checkout Nulls Brawl Apk.
1234.. 177NextPage