Parts required:
- 4pcs of Brushless motor 1000KV
- 4pcs of Electronic Speed Controller (ESC) 30A
- Quadcopter frame (3D printer)
- 6045 blade propeller (6 inch)
- LIPO 2200 mA 20C battery
- Arduino UNO
- Potentiometer
- Jumper Wire
This is just trial to lift an empty frame, without any loading.
Arduino's Coding
// Need the Servo library
#include <Servo.h>
// This is our motor.
Servo myMotor;
//int val = 50;
// This is the final output
// written to the motor.
#include <Servo.h>
// This is our motor.
Servo myMotor;
//int val = 50;
// This is the final output
// written to the motor.
String incomingString;
int val,oldval;
// Set everything up
int val,oldval;
// Set everything up
void setup()
{
Serial.begin(9600);
// Put the motor to Arduino pin #9
myMotor.attach(9);
Serial.println("initializing");
// Required for I/O from Serial monitor
int val = analogRead(0);
int oldval = val;
// Print a startup message
}
void loop()
{
val = analogRead(0);
if (val != oldval)
{
oldval = val;
int laju = map(val,0,1023,0,180);
myMotor.write(laju);
oldval = val;
Serial.println(laju);
delay(500);
}
}
{
Serial.begin(9600);
// Put the motor to Arduino pin #9
myMotor.attach(9);
Serial.println("initializing");
// Required for I/O from Serial monitor
int val = analogRead(0);
int oldval = val;
// Print a startup message
}
void loop()
{
val = analogRead(0);
if (val != oldval)
{
oldval = val;
int laju = map(val,0,1023,0,180);
myMotor.write(laju);
oldval = val;
Serial.println(laju);
delay(500);
}
}
No comments:
Post a Comment