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

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
Author: linga51

GPIO library - WiringPi

[Copy link]

0

Threads

2

Posts

20

Credits

Novice

Rank: 1

Credits
20
Post time 2017-2-28 01:57:41 | Show all posts
Please give me a code to blinking led in orange pi lite.
I have installed wiringOPi library.

2

Threads

30

Posts

250

Credits

Intermediate member

Rank: 3Rank: 3

Credits
250
Post time 2017-3-2 18:51:36 | Show all posts
#include <stdio.h>
#include <wiringPi.h>

#define BLINK_LED 29  //led on port 29

int main()
{
   wiringPiSetup () ;
    pinMode (BLINK_LED, OUTPUT);  //led  

while(1)
{
digitalWrite(BLINK_LED, HIGH);
delay(500);
digitalWrite(BLINK_LED, LOW);
delay(500);
}
}

0

Threads

1

Posts

16

Credits

Novice

Rank: 1

Credits
16
Post time 2017-3-23 10:29:51 | Show all posts
Hello all
I have a Orange pi run Android OS. Please teach me how to use WitingOP for android. I connect GPIO to button and i want build application read event button pressed.
Somebody please help me.
Sorry my english is very bad

0

Threads

3

Posts

20

Credits

Novice

Rank: 1

Credits
20
Post time 2017-3-25 06:02:06 | Show all posts
For standalone PWM (not using Wiring PI). It uses UART0_RX pin on the UART breakout header.

https://github.com/iboguslavsky/pwm-sunxi-opi0.git

Have a look at the examples also.

10

Threads

220

Posts

2000

Credits

Gold member

Rank: 6Rank: 6

Credits
2000
Post time 2017-3-31 18:16:42 | Show all posts
Edited by nopnop2002 at 2017-4-1 23:48
iboguslavsky replied at 2017-3-25 06:02
For standalone PWM (not using Wiring PI). It uses UART0_RX pin on the UART breakout header.

https: ...

Thank you so much for your sharing this wonderful project ...
It's can control my servo-motor(SG90)

  1. #!/bin/bash
  2. #enable pwm
  3. echo 1 > /sys/class/pwm-sunxi-opi0/pwm0/run
  4. sleep 1

  5. #set prescale to 200KHz
  6. cat /sys/class/pwm-sunxi-opi0/pwm0/prescale
  7. echo 0 > /sys/class/pwm-sunxi-opi0/pwm0/prescale
  8. sleep 1

  9. #set entirecycle to 4000
  10. cat /sys/class/pwm-sunxi-opi0/pwm0/entirecycles
  11. echo 4000 > /sys/class/pwm-sunxi-opi0/pwm0/entirecycles
  12. sleep 1

  13. #Move to Center
  14. #cat /sys/class/pwm-sunxi-opi0/pwm0/activecycles
  15. echo 290 > /sys/class/pwm-sunxi-opi0/pwm0/activecycles
  16. sleep 1

  17. #Move to Angle -90
  18. echo 125 > /sys/class/pwm-sunxi-opi0/pwm0/activecycles
  19. sleep 1

  20. #Move to Angle +90
  21. echo 470 > /sys/class/pwm-sunxi-opi0/pwm0/activecycles
  22. sleep 1

  23. #Move to Center
  24. echo 290 > /sys/class/pwm-sunxi-opi0/pwm0/activecycles
  25. sleep 1

  26. #disable pwm
  27. echo 0 > /sys/class/pwm-sunxi-opi0/pwm0/run
Copy the Code
I have decided to write the wrap function by a C language.

https://github.com/nopnop2002/pwmlib-opi
You have to log in before you can reply Login | Register

Points Rules

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

2019-11-15 21:13 GMT+8 , Processed in 0.030704 second(s), 20 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list