Blinking LED

Now let’s look at some code scripts to learn from and test your Xfly Drone.

Blinking LED

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.

				
					#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

Shopping Cart
Scroll to Top