Control Nologo Nano 33 BLE nRF52840 on-board LEDs

Arduino code to control Nologo Nano 33 BLE nRF52840 on-board LEDs



/*
  Exercise run on Nano 33 BLE nRF52840
  to change LEDs.
*/

// the setup function runs once when you press reset or power the board
void setup() {
  delay(1000);
  Serial.begin(9600);
  delay(500);
  Serial.print("LED_BUILTIN: ");
  Serial.println(LED_BUILTIN);
  Serial.print("LEDR: ");
  Serial.println(LEDR);
  Serial.print("LEDG: ");
  Serial.println(LEDG);
  Serial.print("LEDB: ");
  Serial.println(LEDB);

  // set LED pins to output mode
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
  pinMode(LED_BUILTIN, OUTPUT);
  
  //turn off all LED
  digitalWrite(LED_BUILTIN, LOW);
  digitalWrite(LEDR, HIGH);
  digitalWrite(LEDG, HIGH);
  digitalWrite(LEDB, HIGH);
}

void changeRGB(){
  digitalWrite(LEDR, HIGH);
  digitalWrite(LEDG, HIGH);
  digitalWrite(LEDB, HIGH);
  delay(1000);

  digitalWrite(LEDR, LOW);  //LEDR On
  delay(500);

  digitalWrite(LEDR, HIGH); //LEDR Off
  digitalWrite(LEDG, LOW);  //LEDG On
  delay(500);

  digitalWrite(LEDG, HIGH); //LEDG Off
  digitalWrite(LEDB, LOW);  //LEDB On
  delay(500);

  digitalWrite(LEDB, HIGH);  //LEDB Off
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   //LED_BUILTIN Off
  changeRGB();

  digitalWrite(LED_BUILTIN, HIGH);  ////LED_BUILTIN On
  changeRGB();
  
}



Comments

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

my dev.tools - FNIRSI 2C23T 3-in-1 Dual Channel Oscilloscope/Multimeter/Signal Generator