How to program grovepi under C language?

grovepi
cpp

#1

Hello,

Is there any library under jessie (raspberry pi 3) + grovepi shield to use with C programming?
Library seems to exist under Python Language, but not for C language?!
Do we have to install IOT on the raspberrypi 3?

Thanks.

julien


C programming grovepi
#2

Yes there is an official grovepi C library.
https://github.com/DexterInd/GrovePi/tree/master/Software/C


#3

Hello,

thanks, but do you confirm that I need windows 10 IOT on my rbpi?
Julien


#4

Hi @julien.launay,

You can program in C using our library that @graykevinb has posted with Raspbian Jessie itself, you will not need Windows 10 IOT for this. Have a look at the README.md here to learn how to compile and execute C programs in Raspbian image.

-Shoban


C programming grovepi
#5

Hello,

Can you give me where I can find all the Api to read differents grove sensor, and the same for the motor for example.
Best regards.

Julien


#6

Hi @julien.launay,

If you are using the GrovePi then the C library for it is here. However we might not have APIs written for specific sensors. If you have close watch at the library there are APIs for analogRead, analogWrite, digitalRead and digitalWrite. So based on the type of your sensor, you will have to build your own program. For instance you have an analog sensor and you want to read values from it, then use grovepi_analog_read.c.

Also you will not be able to use the Motors on GrovePi, we have a library and few commands in c to control the motors on GoPiGo here.

-Shoban


#7

Hello,

Do you have written API for I2C and UART grove sensor ? do you have a sample ?

Thanks to your help.

Your sincerely.

Julien


#8

@julien.launay,
If you are specificially looking for the low lever I2C API calls in C, they are here .

For UART, there are examples in C like here.

We do not have any examples for Grove sensors using I2C or UART right now, however it should be easy enough to port them to C from python. Is there a specific sensor that want to get working in C?


#9

hi there, i asked myself the same question and found a/my way to programm pi in c++. Don’t know if this could be a way for you but “c” istn “c++” so i dont know.

I dont wanted to use all that windows stuff… you can use for ex. netbeans.

feel free to help me with my actual prop: Button v1.2 / digitalRead


#10

Hi @chkr,

I would take a look at the differences between C++ and C. They are different languages with different views on coding so I suggest you read pages like the following:

  1. https://softwareengineering.stackexchange.com/questions/16390/what-are-the-fundamental-differences-between-c-and-c

  2. http://www.diffen.com/difference/C_vs_C%2B%2B

  3. https://softwareengineering.stackexchange.com/questions/113295/when-to-use-c-over-c-and-c-over-c

We currently support C++ for the GrovePi platform (and no longer C). Here’s a link to our source code and README:

Thank you!