You are here

Vesc and Arduino Interface with ppm control????

1 post / 0 new
ruthvikchanda
Offline
Last seen: 4 years 4 months ago
Joined: 2018-08-15 12:40
Posts: 5
Vesc and Arduino Interface with ppm control????

We are trying to control the flipsky motor with flipsy esc 4.12 using the Arduino with the potentiometer which gives ppm values. The issue is that the centre value of the ppm is not being constant  and when disconnected with the battery the cdentre value is changing.So anyone can help me doing this?????

The Code used for the vesc and the arduino interface was this:

#include <Servo.h>
#define VescOutputPin 9

long v,val;
float val2;
Servo esc;
void setup() 
{
  esc.attach(VescOutputPin);
  esc.writeMicroseconds(721.0);
  Serial.begin(9600);
}
void loop() 
{
  v= analogRead(A0);
  Serial.print(v);
  val= map(v, 0 , 1023, 7150, 7330);
  val2= val*0.1;
  Serial.print(", ");
  Serial.print(val);
  Serial.print(", ");
  Serial.println(val2);
  esc.writeMicroseconds(val2);
  delay(15);
}