Blinking LEDs
Now let’s look at some code scripts to learn from and test your X-Fly Drone.
“Welcome to the Blinking LEDs Guide for X-Fly Drone. This tutorial will help you test and learn from your X-Fly Drone using simple code scripts. In this guide, you’ll use the STATUS and ERROR LEDs on the X-Fly Board to practice basic LED control. Follow the steps carefully to ensure a smooth experience while exploring this functionality.”
“To begin, ensure the X-Fly Board is powered on. You don’t need to connect the battery for this test, but the power switch must be turned on.”
“The X-Fly Board includes two LEDs, named STATUS and ERROR. This section provides the code to manually control these LEDs.”
“Here’s how to upload the script to blink the LEDs on your X-Fly Drone. Make sure you follow each step precisely to avoid errors.”
Blinking LEDs
The X-Fly Board, there are 2 LEDs named STATUS and ERROR. Let’s manually blink these two LEDs using the following code. Connecting the battery is not essential for this example. Make sure to turn on the power switch before uploading the code.
You may experiment with different LED patterns to make sure that you fully understood the working principle.
#define STATUS_LED 6
#define ERROR_LED 19
void setup() {
// Initialize the LED pins as outputs
pinMode(STATUS_LED, OUTPUT);
pinMode(ERROR_LED, OUTPUT);
}
void loop() {
// Turn on the status LED for 500ms
digitalWrite(STATUS_LED, HIGH); // Turn STATUS_LED on
delay(500);// Wait for 500ms
digitalWrite(STATUS_LED, LOW); // Turn STATUS_LED off
// Now let's assume you want the ERROR_LED to be on for 500ms as well
digitalWrite(ERROR_LED, HIGH);// Turn ERROR_LED on
delay(500);// Wait for 500ms
digitalWrite(ERROR_LED, LOW);// Turn ERROR_LED off
}
QubeBots Pvt Ltd is a startup that focuses on developing Edutech products to support the global STEM Education system.
Contact us
hello@qubebots.com
+94 77 069 5151
Colombo, Sri Lanka