Keval Ajmeri
Published

Lamp on a Drone

Using Pluto X, LED and a servo, I built a lamp with actual visual characteristics of a flame!

BeginnerShowcase (no instructions)30 minutes585
Lamp on a Drone

Things used in this project

Hardware components

Drona Aviation Pluto X
×1
2g servo
×1
8mm LED
×1
Yello gelatin pape
×1

Software apps and online services

Pluto Controller App
Cygnus IDE

Story

Read more

Code

Lamp using LED and Servo on Pluto X

C/C++
Build the project on Cygnus IDE and flash it on your Pluto X drone
// Do not remove the include below
#include "PlutoPilot.h"
#include "Utils.h"
#include "Peripheral.h"
#include "Motor.h"
#include <stdlib.h>

//The setup function is called once at PlutoX's hardware startup
void plutoInit()
{
//Add your hardware initialization code here

	PWM.init(Pin10, 50);
	Motor.init(M1);
}


//The function is called once before plutoLoop() when you activate developer mode
void onLoopStart()
{
//Do your one time stuff here

	LED.flightStatus(DEACTIVATE);
}


//The loop function is called in an endless loop
void plutoLoop()
{
//Add your repeated code here

	int rand();
	int random1, random2;

	random1 = (rand()%500);
	random2= (rand()%150);

	PWM.write(Pin10, 1100+random2);
	Motor.set(M1, 1200+(random1));

	LED.set(BLUE, ON);
	LED.set(RED, OFF);
}


//The function is called once after plutoLoop() when you deactivate developer mode
void onLoopFinish()
{
//Do your cleanup stuff here

	LED.flightStatus(ACTIVATE);
	Motor.set(M1, 1000);
}

Credits

Keval Ajmeri
2 projects • 1 follower

Comments