Isaac96:
Could you post your code that doesn't work?
#include <Wire.h>
#include <Servo.h>
Servo bl; //back left
Servo fl; //front left
Servo fr; //front right
Servo br; //back right
int potenza=0;
byte ricevuto[3];
int cont=0;
int pos;
boolean l= false;
boolean r = false;
void setup()
{
bl.attach(2);
fl.attach(7);
fr.attach(9);
br.attach(11);
pinMode(13, OUTPUT);
Wire.begin(4); // i2c
Serial.begin(9600);
Serial.println("ciao");
// inizializzo seriale
Wire.onReceive(receiveEvent); // register event
}
void loop()
{
if(l==true)
{
l=false;
potenza=ricevuto[1];
bl.write(ricevuto[1] + ricevuto[0]);
delay(10);
fl.write(ricevuto[1]);
delay(10);
fr.write(ricevuto[1] + ricevuto[0]);
delay(10);
br.write(ricevuto[1]);
delay(10);
}
if(r==true)
{
/* r=false;
bl.write(potenza + ricevuto[1]);
delay(10);
br.write(potenza + ricevuto[1]);
delay(10);*/
}
delay(100);
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int howMany)
{
while(0 < Wire.available()) // loop through all but the last
{
for(int i=0; i<3; i++)
{
ricevuto*=Wire.read();*
_ Serial.print(ricevuto + ",");_
* }*
* Serial.println("");*
if(ricevuto[cont] != 108 || ricevuto[cont]!= 114)
* cont++;*
* else if(ricevuto[cont] == 108 )*
* {*
* cont=0;*
* l = true;*
* }*
* else*
* {*
* cont=0;*
* r=true;*
* }*
* digitalWrite(13, HIGH);*
* }*
}
> cr0sh:
> Are you performing the proper arming sequence for your ESCs?
Sorry I don't get when you say arming if you mean the calibration of the escs I already did it!!
> TomGeorge:
> Hi,
> How are you using servos on a quadcopter.
> Can you post a picture of your servos and controller.
>
> What is your electronics, programming, arduino, hardware experience?
>
> Tom..... ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12)
Well I use an arduino yun and a Crius that works as an arduino mega it's used for quadcopters to connect the escs, i connect them through I2C , i don't have a controller i just controll them with an app created to android, so to sum up briefly I'am creating a quadcopter controlled by app(android) ,which send data to yun and this will send it to the crius by I2C and then it will give the istruction to motors to move!!!
I am a junior programmer =)
Thanks for everyone !!!