Programming in C


#1

I’m programming BrickPi in C and I’ve been trying to understand the API. I’ve noticed in that in all example projects there is this code:
BrickPi.Address[0] = 1;
BrickPi.Address[1] = 2;
I don’t understand what it does. If anyone can explain it to me I would be very thankful.


#2

The RPi communicates with the BrickPi using UART. The BrickPi has two AtMega328Ps (each one handles two sensor ports, and two motor ports). The UART communication uses addresses so that each AtMega328P knows when the RPi is talking to it. In the RPi program, you need to tell the RPi the two addresses of the AtMega328Ps. By default (when shipped) the BrickPi AtMega328Ps use addresses 1 and 2.