Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   How to use C with a Raspberry Pi servo HAT? (http://www.chiefdelphi.com/forums/showthread.php?t=149660)

Ngang 26-07-2016 11:29

How to use C with a Raspberry Pi servo HAT?
 
Hi, I've been working on a project not entirely FRC related but I was hoping someone would have some advice.

It's my first time working with Raspberry Pi, but my team wants to try and use them and ROS to control a large group of robots with C, but it doesn't seem like C is really supported by that many libraries with the HAT. Are there other programming languages more viable for this? Does anyone have any experience with the HAT and C?

Andrew Lobos 26-07-2016 11:39

Re: How to use C with a Raspberry Pi servo HAT?
 
I ported the Adafruit servo HAT library to C++ for a personal project a while ago. Worked great for driving a few victors on a small robot. This is the HAT I used: https://www.adafruit.com/products/2327

Here's the source: https://github.com/4ndr3w/PiBot/blob...rivers/PWM.cpp

https://github.com/4ndr3w/PiBot/blob.../drivers/PWM.h

You'll need to link it with the WiringPI library.

Also be very careful if you're driving a large robot like this - if your program crashes/exits, the servo hat will keep outputting the last PWM value it was set at.

Ngang 26-07-2016 11:58

Re: How to use C with a Raspberry Pi servo HAT?
 
Thanks!


All times are GMT -5. The time now is 09:14.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi