====== Using GPIOs in Arduino with flipper board ====== ---- tags: flipper, Arduino, GPIO If you need to use a flipper GPIO in Arduino, you need to find the arduino name of the GPIO : To do so, use following table and check for the arduino name of the GPIO you want to use.\\ The GPIOs are described in the following spreadsheet file: {{ :products:flipper:gpio_flipper.xlsx |}} {| border="1" width="86" cellspacing="0" |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|Header 1 (J402) |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|expander pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|name in arduino | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|1 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|VIN | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|2 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|GND | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|3 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|VCC | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|4 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|BRD_EN | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|5 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|VCC_SW_EN | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|6 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|3V3_SW_EN | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|7 | align="center" valign="bottom"|0 | align="center" valign="bottom"|11 | align="center" valign="bottom"|11 | align="center" valign="bottom"|I2C0_SDA | align="center" valign="bottom"|PIN_WIRE_SDA | align="center" valign="bottom"|0 |- | align="center" valign="bottom" height="17"|8 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|3V3 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|9 | align="center" valign="bottom"|0 | align="center" valign="bottom"|8 | align="center" valign="bottom"|8 | align="center" valign="bottom"|I2C0_SCL | align="center" valign="bottom"|PIN_WIRE_SCL | align="center" valign="bottom"|1 |- | align="center" valign="bottom" height="17"|10 | align="center" valign="bottom"|1 | align="center" valign="bottom"|8 | align="center" valign="bottom"|40 | align="center" valign="bottom"|SPI0_MISO | align="center" valign="bottom"|PIN_SPI_MISO | align="center" valign="bottom"|2 |- | align="center" valign="bottom" height="17"|11 | align="center" valign="bottom"|0 | align="center" valign="bottom"|6 | align="center" valign="bottom"|6 | align="center" valign="bottom"|SPI0_MOSI | align="center" valign="bottom"|PIN_SPI_MOSI | align="center" valign="bottom"|3 |- | align="center" valign="bottom" height="17"|12 | align="center" valign="bottom"|0 | align="center" valign="bottom"|25 | align="center" valign="bottom"|25 | align="center" valign="bottom"|SPIO_CS1 | align="center" valign="bottom"|SS2 | align="center" valign="bottom"|4 |- | align="center" valign="bottom" height="17"|13 | align="center" valign="bottom"|0 | align="center" valign="bottom"|4 | align="center" valign="bottom"|4 | align="center" valign="bottom"|SPIO_SCLK | align="center" valign="bottom"|PIN_SPI_SCK | align="center" valign="bottom"|5 |- | align="center" valign="bottom" height="17"|14 | align="center" valign="bottom"|0 | align="center" valign="bottom"|14 | align="center" valign="bottom"|14 | align="center" valign="bottom"|UART1_TX | align="center" valign="bottom"|PIN_SERIAL2_TX | align="center" valign="bottom"|6 |- | align="center" valign="bottom" height="17"|15 | align="center" valign="bottom"|0 | align="center" valign="bottom"|16 | align="center" valign="bottom"|16 | align="center" valign="bottom"|UART1_RX | align="center" valign="bottom"|PIN_SERIAL2_TX | align="center" valign="bottom"|7 |- | align="center" valign="bottom" height="17"|16 | align="center" valign="bottom"|0 | align="center" valign="bottom"|13 | align="center" valign="bottom"|13 | align="center" valign="bottom"|UART0_TX | align="center" valign="bottom"|PIN_SERIAL1_TX | align="center" valign="bottom"|8 |- | align="center" valign="bottom" height="17"|17 | align="center" valign="bottom"|0 | align="center" valign="bottom"|15 | align="center" valign="bottom"|15 | align="center" valign="bottom"|UART0_RX | align="center" valign="bottom"|PIN_SERIAL1_RX | align="center" valign="bottom"|9 |- | align="center" valign="bottom" height="17"|18 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|EXT_RST | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|19 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|GND | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|20 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|VUSB | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|Header 2 (J401) |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|expander pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|  | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|21 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|VBAT | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|22 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|GND | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|23 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|VDD_SW_EN | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|24 | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|3V3_SW_EN | align="center" valign="bottom" bgcolor="#FF0000"|  | align="center" valign="bottom" bgcolor="#FF0000"|  |- | align="center" valign="bottom" height="17"|25 | align="center" valign="bottom"|1 | align="center" valign="bottom"|1 | align="center" valign="bottom"|33 | align="center" valign="bottom"|user_defined | align="center" valign="bottom"|EXP_25 | align="center" valign="bottom"|10 |- | align="center" valign="bottom" height="17"|26 | align="center" valign="bottom"|0 | align="center" valign="bottom"|12 | align="center" valign="bottom"|12 | align="center" valign="bottom"|I2C1_SDA | align="center" valign="bottom"|PIN_WIRE1_SDA | align="center" valign="bottom"|11 |- | align="center" valign="bottom" height="17"|27 | align="center" valign="bottom"|1 | align="center" valign="bottom"|11 | align="center" valign="bottom"|43 | align="center" valign="bottom"|user_defined | align="center" valign="bottom"|EXP_27 | align="center" valign="bottom"|12 |- | align="center" valign="bottom" height="17"|28 | align="center" valign="bottom"|1 | align="center" valign="bottom"|9 | align="center" valign="bottom"|41 | align="center" valign="bottom"|I2C1_SCL | align="center" valign="bottom"|PIN_WIRE1_SCL | align="center" valign="bottom"|13 |- | align="center" valign="bottom" height="17"|29 | align="center" valign="bottom"|0 | align="center" valign="bottom"|30 | align="center" valign="bottom"|30 | align="center" valign="bottom"|user_defined/AIN6 | align="center" valign="bottom"|EXP_29 | align="center" valign="bottom"|14 |- | align="center" valign="bottom" height="17"|30 | align="center" valign="bottom"|1 | align="center" valign="bottom"|13 | align="center" valign="bottom"|45 | align="center" valign="bottom"|user_defined | align="center" valign="bottom"|EXP_30 | align="center" valign="bottom"|15 |- | align="center" valign="bottom" height="17"|31 | align="center" valign="bottom"|0 | align="center" valign="bottom"|2 | align="center" valign="bottom"|2 | align="center" valign="bottom"|user_defined/AIN0 | align="center" valign="bottom"|EXP_31 | align="center" valign="bottom"|16 |- | align="center" valign="bottom" height="17"|32 | align="center" valign="bottom"|0 | align="center" valign="bottom"|28 | align="center" valign="bottom"|28 | align="center" valign="bottom"|user_defined/AIN7 | align="center" valign="bottom"|EXP_32 | align="center" valign="bottom"|17 |- | align="center" valign="bottom" height="17"|33 | align="center" valign="bottom"|1 | align="center" valign="bottom"|10 | align="center" valign="bottom"|42 | align="center" valign="bottom"|LED_BLUE | align="center" valign="bottom"|LED_BLUE | align="center" valign="bottom"|18 |- | align="center" valign="bottom" height="17"|34 | align="center" valign="bottom"|0 | align="center" valign="bottom"|29 | align="center" valign="bottom"|29 | align="center" valign="bottom"|user_defined/AIN5 | align="center" valign="bottom"|EXP_34 | align="center" valign="bottom"|19 |- | align="center" valign="bottom" height="17"|35 | align="center" valign="bottom"|1 | align="center" valign="bottom"|7 | align="center" valign="bottom"|39 | align="center" valign="bottom"|LED_GREEN | align="center" valign="bottom"|LED_GREEN | align="center" valign="bottom"|20 |- | align="center" valign="bottom" height="17"|36 | align="center" valign="bottom"|0 | align="center" valign="bottom"|3 | align="center" valign="bottom"|3 | align="center" valign="bottom"|user_defined/EN_EXP | align="center" valign="bottom"|EXP_36 | align="center" valign="bottom"|21 |- | align="center" valign="bottom" height="17"|37 | align="center" valign="bottom"|1 | align="center" valign="bottom"|5 | align="center" valign="bottom"|37 | align="center" valign="bottom"|LED_RED | align="center" valign="bottom"|LED_RED | align="center" valign="bottom"|22 |- | align="center" valign="bottom" height="17"|38 | align="center" valign="bottom"|1 | align="center" valign="bottom"|6 | align="center" valign="bottom"|38 | align="center" valign="bottom"|USER_BTN | align="center" valign="bottom"|PIN_BUTTON1 | align="center" valign="bottom"|23 |- | align="center" valign="bottom" height="17"|39 | align="center" valign="bottom"|0 | align="center" valign="bottom"|9 | align="center" valign="bottom"|9 | align="center" valign="bottom"|user_defined | align="center" valign="bottom"|EXP_39 | align="center" valign="bottom"|24 |- | align="center" valign="bottom" height="17"|40 | align="center" valign="bottom"|0 | align="center" valign="bottom"|10 | align="center" valign="bottom"|10 | align="center" valign="bottom"|user_defined | align="center" valign="bottom"|EXP_40 | align="center" valign="bottom"|25 |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|On Board QSPI FLASH |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|QSPI pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|  | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|6 | align="center" valign="bottom"|0 | align="center" valign="bottom"|19 | align="center" valign="bottom"|19 | align="center" valign="bottom"|FLASH_CLK | align="center" valign="bottom"|PIN_QSPI_SCK | align="center" valign="bottom"|26 |- | align="center" valign="bottom" height="17"|1 | align="center" valign="bottom"|0 | align="center" valign="bottom"|17 | align="center" valign="bottom"|17 | align="center" valign="bottom"|FLASH_CS | align="center" valign="bottom"|PIN_QSPI_CS | align="center" valign="bottom"|27 |- | align="center" valign="bottom" height="17"|5 | align="center" valign="bottom"|0 | align="center" valign="bottom"|20 | align="center" valign="bottom"|20 | align="center" valign="bottom"|FLASH_IO0/FLASH_MOSI | align="center" valign="bottom"|PIN_QSPI_IO0 | align="center" valign="bottom"|28 |- | align="center" valign="bottom" height="17"|2 | align="center" valign="bottom"|0 | align="center" valign="bottom"|21 | align="center" valign="bottom"|21 | align="center" valign="bottom"|FLASH_IO1/FLASH_MISO | align="center" valign="bottom"|PIN_QSPI_IO1 | align="center" valign="bottom"|29 |- | align="center" valign="bottom" height="17"|3 | align="center" valign="bottom"|0 | align="center" valign="bottom"|22 | align="center" valign="bottom"|22 | align="center" valign="bottom"|FLASH_IO2 | align="center" valign="bottom"|PIN_QSPI_IO2 | align="center" valign="bottom"|30 |- | align="center" valign="bottom" height="17"|7 | align="center" valign="bottom"|0 | align="center" valign="bottom"|23 | align="center" valign="bottom"|23 | align="center" valign="bottom"|FLASH_IO3 | align="center" valign="bottom"|PIN_QSPI_IO3 | align="center" valign="bottom"|31 |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|On Board SD CARD READER |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|SD pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|  | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|5 | align="center" valign="bottom"|0 | align="center" valign="bottom"|7 | align="center" valign="bottom"|7 | align="center" valign="bottom"|SD_SPI_SCLK | align="center" valign="bottom"|PIN_SPI1_SCK | align="center" valign="bottom"|32 |- | align="center" valign="bottom" height="17"|2 | align="center" valign="bottom"|0 | align="center" valign="bottom"|5 | align="center" valign="bottom"|5 | align="center" valign="bottom"|SD_SPI_CS | align="center" valign="bottom"|SS1 | align="center" valign="bottom"|33 |- | align="center" valign="bottom" height="17"|3 | align="center" valign="bottom"|0 | align="center" valign="bottom"|27 | align="center" valign="bottom"|27 | align="center" valign="bottom"|SD_SPI_MOSI | align="center" valign="bottom"|PIN_SPI1_MOSI | align="center" valign="bottom"|34 |- | align="center" valign="bottom" height="17"|7 | align="center" valign="bottom"|0 | align="center" valign="bottom"|26 | align="center" valign="bottom"|26 | align="center" valign="bottom"|SD_SPI_MISO | align="center" valign="bottom"|PIN_SPI1_MISO | align="center" valign="bottom"|35 |- | align="center" valign="bottom" height="17"|TPS | align="center" valign="bottom"|1 | align="center" valign="bottom"|15 | align="center" valign="bottom"|47 | align="center" valign="bottom"|SD_EN_PIN | align="center" valign="bottom"|SDCARD_EN_PIN | align="center" valign="bottom"|36 |- | align="center" valign="bottom" height="17"|9 | align="center" valign="bottom"|1 | align="center" valign="bottom"|14 | align="center" valign="bottom"|46 | align="center" valign="bottom"|SD_DETECT_PIN | align="center" valign="bottom"|SDCARD_DETECT_PIN | align="center" valign="bottom"|37 |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|Xlbee pins |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|Xlbee pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|  | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|U302(3) | align="center" valign="bottom"|1 | align="center" valign="bottom"|3 | align="center" valign="bottom"|35 | align="center" valign="bottom"|MCU_XLB_EN | align="center" valign="bottom"|XLB_EN | align="center" valign="bottom"|38 |- | align="center" valign="bottom" height="17"|5 | align="center" valign="bottom"|1 | align="center" valign="bottom"|2 | align="center" valign="bottom"|34 | align="center" valign="bottom"|!XLB_RST! | align="center" valign="bottom"|XLB_RST | align="center" valign="bottom"|39 |- | align="center" valign="bottom" height="17"|37 | align="center" valign="bottom"|0 | align="center" valign="bottom"|31 | align="center" valign="bottom"|31 | align="center" valign="bottom"|SPI0_CS0 | align="center" valign="bottom"|SS | align="center" valign="bottom"|40 |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|Analog Pins |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|Analog pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|  | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|VBAT_MES | align="center" valign="bottom"|0 | align="center" valign="bottom"|24 | align="center" valign="bottom"|24 | align="center" valign="bottom"|AIN7 | align="center" valign="bottom"|PIN_A0 | align="center" valign="bottom"|41 |- | colspan="7" align="center" valign="middle" bgcolor="#FFFF00" height="17"|Output Voltage Enablers |- | align="center" valign="bottom" bgcolor="#729FCF" height="17"|TPS pin | align="center" valign="bottom" bgcolor="#729FCF"|port | align="center" valign="bottom" bgcolor="#729FCF"|pin | align="center" valign="bottom" bgcolor="#729FCF"|identifier | align="center" valign="bottom" bgcolor="#729FCF"|rôle | align="center" valign="bottom" bgcolor="#729FCF"|  | align="center" valign="bottom" bgcolor="#729FCF"|PinMap Pos |- | align="center" valign="bottom" height="17"|U304(3) | align="center" valign="bottom"|1 | align="center" valign="bottom"|12 | align="center" valign="bottom"|44 | align="center" valign="bottom"|3V3_SW_EN | align="center" valign="bottom"|SW_3V3_EN | align="center" valign="bottom"|42 |- | align="center" valign="bottom" height="17"|U305(3) | align="center" valign="bottom"|1 | align="center" valign="bottom"|4 | align="center" valign="bottom"|36 | align="center" valign="bottom"|VDD_SW_EN | align="center" valign="bottom"|SW_VDD_EN | align="center" valign="bottom"|43 |} Then you can use it and declare it as an INPUT or an OUTPUT using pinMode() function. If it is an output you can set its state using digitalWrite() function. For example we want to activate 3V3_SW, it is a power-rail that is commanded by the GPIO : 3V3_SW_EN. The corresponding arduino name is : SW_3V3_EN. In our arduino sketch we can write : pinMode(SW_3V3_EN, OUTPUT); digitalWrite(SW_3V3_EN, HIGH); This will configure SW_3V3_EN as an output and set its state to high=1. So it will activate our power rail 3V3_SW.