Pin Definitions - Mango-kid/maciot GitHub Wiki

The below table defines all of the pins on the board and how they will be used in software. The column Arduino Pin refers to the physical label on the MacIoT Board.

An Image of some of the pin labels

For an example lets say you wanted to setup the LED number 0 as an output so that we can later blink it. We would refer to the LED in software as below.

pinMode(LED0, OUTPUT); // setup the pin connected to LED0 as an output

Another example would be that we wanted to use a pin on the Arduino header as an input because it is connected to an external limit switch. In that case we would use the following

pinMode(D4, INPUT) // setup Arduino pin 4 as a digital input

A final example is if we want to connect to one of the sensor pins. Lets say we want to read the value of the battery voltage pin. We would use the command below. Keep in mind this doesnt return a voltage it returns an ineger value that must be converted.

int sensorVal = analogRead(VBATT_SENSE)
Arduino Pin Software Name Other Resource
A0 A0 N/A
A1 A1 N/A
A2 A2 N/A
A3 A3 N/A
A4 A4 N/A
A5 A5 Touch Sense
0 D0 UART: RX
1 D1 UART: TX
2 D2 Touch Sense
3 D3
4 D4
5 D5 Touch Sense
6 D6
7 D7
8 D8 Touch Sense
9 D9
10 D10 SPI: SS(CS)
11 D11 SPI: MOSI
12 D12 SPI: MISO
13 D13 SPI: SCK
N/A SCL; SWICTH2 I2C: SCL; Switch 2
N/A I2C: SDA
N/A SWITCH1 Switch 1
N/A SWICTH0 Switch 0
N/A LED0 LED 0 (Top)
N/A LED1 LED 1
N/A LED2 LED 2
N/A LED3 LED 3 (Bottom)
N/A LDR_SENSE Light Sensor
N/A VBATT_SENSE Battery Voltage (VPP)