Translate Arduino code to Proton.

Başlatan buntger, 25 Temmuz 2016, 13:36:34

buntger

Hello, All

I have a problem with an engine acceleration PWM works with analog joystick of the PS3 and accelerating very fast.
with this code I found quite solves the problem and is much smoother.
The only thing I do not understand many parts, so that they can write in Proton.

Arduino Code:

void loop() {


potval=analogRead(potentiometer);
potval=map(potval,0,1023,0,180);


while(curval<potval){
  potval=analogRead(potentiometer);
  potval=map(potval,0,1023,0,180);
  curval=curval+1;
  ESC.write(curval);
  SoftwareServo::refresh();
  Serial.println(curval);
  delay(50);}


THX.

trgtylcnky

I do not know Proton but it seems the program increases the speed by 1 per 50 miliseconds until the desired value is reached. How do you control the ESC in Proton?