View: 5404|Reply: 5

OPI-Zero GPIO control

[Copy link]

3

threads

8

posts

37

credits

Novice

Rank: 1

credits
37
Published in 2017-1-18 23:56:58 | Show all floors |Read mode
Hello guys,
how can I control the GPIO's of my OPI-Zero and is it possible to control a servomotor ?
Hope someone can help me

Thank You
and greetings  
r00X

3

threads

8

posts

37

credits

Novice

Rank: 1

credits
37
 Author| Published in 2017-1-19 23:14:58 | Show all floors
Update: I get WiringPi installed so the GPIO's are working but I dont know how I can controll my Servo

3

threads

8

posts

37

credits

Novice

Rank: 1

credits
37
 Author| Published in 2017-1-20 04:47:24 | Show all floors
Edited by r00X at 2017-1-20 04:48

Update: The Servo rotates but after that I loos the connection - it seems that the OrangePi Zero crashes...

Here the Code:
  
  1. #include <stdio.h>
  2. #include <wiringPi.h>
  3. #include <softPwm.h>


  4. int main(void)
  5. {

  6. if (wiringPiSetup()) ;

  7. pinMode(7, OUTPUT);
  8. digitalWrite(7, LOW);
  9. softPwmCreate(7, 0, 50);
  10. softPwmWrite(7, 1);

  11. for (;;) delay (10000) ;
  12. return 0;
  13. }
Copy code


It would be nice if someone can help me

Thanks
r00X

1

threads

64

posts

240

credits

Intermediate member

Rank: 3Rank: 3

credits
240
Published in 2017-1-20 21:59:14 | Show all floors
Your servo might be draining too much power from GPIO, which is not meant to be used as a power source - as a result the SoC crashes.
To avoid such a thing you should use servo driver with separate power supply.

3

threads

8

posts

37

credits

Novice

Rank: 1

credits
37
 Author| Published in 2017-1-21 00:01:55 | Show all floors
Edited by r00X at 2017-1-21 01:43

Hello shooreg,

thank you so mutch 4 your answer, i will test it out !

Edit: It works - Thx

2

threads

9

posts

68

credits

Registered member

Rank: 2

credits
68
Published in 2017-1-31 22:34:55 | Show all floors
Hello r00X,

What did You install to get the wiringPi up and working? I think I have installed a wrong wiring version. On the commandline  gpio readall return a pinout listing. It is showing 40 pins though there are only 26 on the zero. The C blink program was not able to set or reset a gpio pin.

Greetings,

Eduard
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list