C- Communicating with the Arduberry

C- Communicating with the Arduberry

This is a tutorial to get you started with sending and receiving the data, to and from the Arduberry, directly from the ease of your C programs.

Step 1: Setting up the Raspberry Pi

Follow the Getting Started to Arduberry guide and run the install script to set up the libraries for the Arduberry.

Step 2: Upload the sketch to Arduberry

Open the Arduino IDE on the Raspberry Pi, and open the serial_arduberry.ino in the Arduberry Github Repository .

arduino_prog

Choose the programmer as Raspberry Pi GPIO and the board as Arduino Uno and use “Upload as a Programmer” or press “Ctrl+Shift+U” to upload the sketch to the Arduberry.

upload4Step 3: Run the C program

We have created a sample C program which sends a command to the Arduberry and reads a string and an analog value back from the Arduberry.

Compile the C program:

 gcc ser.c -l wiringPi

 

compile

and run the C program and the data should start coming on the terminal:

./a.out

c_run
You can modify this program and the Arduino sketch to send or receive any data to and from your C program.

Questions?  Ask on the forums and we’ll help you out.