https://4rdp.blogspot.com/2015/08/rosa-1.html?m=0
接下來將一系列專文說明 ROSA 的程式開發,複雜的東西就是要切塊逐一處理,因為 Arduino 有很多 pin 腳,每隻腳都是獨立運作,因此採功能模組方式開發,參考程式範例如下:
// (C) 2015, Bridan Wang, CC BY-NC-SA 3.0 TW
// http://4rdp.blogspot.tw/search/label/ROSA%20(Arduino)
// System
#define TARGET mBot
#if TARGET == mBot
#define DIGITAL 14
#define ANALOG 8
#elif TARGET == motoduino
#define DIGITAL 14
#define ANALOG 6
#elif TARGET == UNO
#define DIGITAL 14
#define ANALOG 6
#endif
enum { // CONFigure
DOUT,
DIN,
DIN_UP,
ADIN,
ADIN_UP,
PWM_,
LED = 7,
TONE,
SERVO,
I2C,
SER_RX,
SER_TX,
IR_RX,
IR_TX,
XXXX
};
const byte CFD[] PROGMEM = { // DIGITAL + ANALOG pin default
#if TARGET == mBot
SER_RX, SER_TX, IR_RX, IR_TX, DIN, DIN, DIN, DIN,
TONE, DIN, DIN, DIN, DIN, LED,
ADIN, ADIN, ADIN, ADIN, ADIN, ADIN, ADIN, ADIN
#elif TARGET == motoduino
SER_RX, SER_TX, DIN, DIN, SERVO, PWM_, PWM_, SERVO,
SERVO, PWM_, DOUT, DOUT, DOUT, DOUT,
ADIN, ADIN, ADIN, ADIN, ADIN, ADIN
#elif TARGET == UNO
SER_RX, SER_TX, IR_RX, IR_TX, DIN, DIN, DIN, DIN,
TONE, DIN, DIN, DIN, DIN, LED,
ADIN, ADIN, ADIN, ADIN, ADIN, ADIN
#endif
};