pdf-icon

Arduino Quick Start

2. Devices & Examples

NanoC6 Arduino Program Compilation & Upload

1.Preparation

2.Port Selection

Connect the device to the computer via a USB cable. In the Arduino IDE, you can select the corresponding port for the device.

3.Program Compilation & Upload

Enter the following code in the Arduino IDE workspace, and click the upload button. The program will be automatically compiled and uploaded.

Note:
1. This example is realized based on Adafruit NeoPixel library, please install Adafruit NeoPixel dependency library through the library manager before use.
2.M5NanoC6 LED is an RGB light bead. To enable the light bead, a high-level control signal is required for the ENABLE_PIN in the following code.
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include <Adafruit_NeoPixel.h>

#define LED_PIN    20
#define ENABLE_PIN 19
#define NUM_LEDS   1

Adafruit_NeoPixel strip(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(ENABLE_PIN, OUTPUT);
  digitalWrite(ENABLE_PIN, HIGH);
  strip.begin();
  strip.show();
}

void loop() {
    //RED
    strip.setPixelColor(0, strip.Color(255, 0, 0));
    strip.show();
    delay(100);

    //GREEN
    strip.setPixelColor(0, strip.Color(0, 255, 0));
    strip.show();
    delay(100);

    //BLUE
    strip.setPixelColor(0, strip.Color(0, 0, 255));
    strip.show();
    delay(100);
}

After uploading the code, you will be able to see the RGB LED lights on the M5NanoC6 device cycling through the colors red, green, and blue.

On This Page