#3 Arduino Nano 33 BLE - Toggling GPIO pin on Arduino Nano 33 BLE board

#3 Arduino Nano 33 BLE - Toggling GPIO pin on Arduino Nano 33 BLE board


The purpose of this program is to toggle the LED connected to the below highlighted pin using Arduino IDE.


The confusion lies for the beginners is how to refer the pin number for the PIN#1 of the JP3 connector in the code. It can be referred as D0 or 0

// Toggle LED connected to pin D0 (RX)
// Works only if Serial1 is not active

const int ledPin = D0;    // RX pin (P0.08 on nRF52840)
//const int ledPin = 0;    // can be referred as 0 as well

void setup() {
  pinMode(ledPin, OUTPUT);  // configure D0 as output
}

void loop() {
  digitalWrite(ledPin, HIGH);   // turn LED ON
  delay(500);                   // wait 500ms
  digitalWrite(ledPin, LOW);    // turn LED OFF
  delay(500);                   // wait 500ms
}

-----------------------------

Below is the pin mapping for the other pins on JP2 and JP3 connector.

Arduino Pin MCU Pin (nRF52840) Notes
D0 P1.10 RX
D1 P1.03 TX
D2 P1.11
D3 P1.12
D4 P1.15
D5 P1.13
D6 P1.14
D7 P0.23
D8 P0.21
D9 P0.27
D10 P1.02 SPI CS
D11 P1.01 MOSI
D12 P1.08 MISO
D13 P0.13 SCK / Built-in LED
A0 P0.04
A1 P0.05
A2 P0.30
A3 P0.29
A4 P0.31 SDA
A5 P0.02 SCL
A6 P0.28
A7 P0.03

SCK has built-in LED, that is why we see that both on-board LED and externally connected LED are blinking




Post a Comment

0 Comments