Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 1397|Reply: 1

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

[Copy link]

2

Threads

3

Posts

72

Credits

Registered member

Rank: 2

Credits
72
Post time 2021-6-17 03:44:59 | Show all posts |Read mode
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
Copy the Code

Code:
Download code

Demo:
Demo Video
Demo Video 2
Demo video 3

9

Threads

40

Posts

171

Credits

Registered member

Rank: 2

Credits
171
Post time 2021-9-28 20:10:03 | Show all posts
Well thank you so much for sharing this info which is I think really helpful for others too which are trying to do the same, which is why I will definitely share this info with my friend on this FMWhatsApp Apk.
You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2021-10-26 23:20 GMT+8 , Processed in 0.029724 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list