Servo with button

Hi im new in using blynk i have a little background with C programming and arduino.
How will I encode if i want my servo to rotate from initial 0 to 180 once I press a button once then returns back after a short delay?

Here is my code controlling the servo using a button in arduino:

(#) include <(Servo.h)>

Servo myservo;

const int servoPin = 9;
const int buttonPin = 12;

void setup() {
myservo.attach(servoPin);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
myservo.write(180);
delay(1000);
myservo.detach();
}

void loop() {
int buttonVal = digitalRead(buttonPin);
if(buttonVal == LOW) {
myservo.attach(servoPin);
myservo.write(30);
delay(575);
myservo.write(180);
delay(1500);
myservo.detach();
delay(500);
}
delay(13);
}

Hi there, please check the docs:
http://docs.blynk.cc/#blynk-main-operations-send-data-from-app-to-hardware

Basically you just put the function inside of

BLYNK_WRITE(V1) //Button Widget is writing to pin V1
{
  int pinData = param.asInt(); 
}
1 Like

Can you give an example?

Https://examples.blynk.cc