Pan Tilt servo

Hi i would like to use the app to pan and tilt a camera using 2 x servos. Currently i can move two servos but both at the same time and not independently as i would like. I belive my problem lies with the BLYNK_WRITE(V4) function. Here is what i have can anyone help?

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <Servo.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = “124efcc76b87427c8bd305426a647c95”;

Servo servo1, servo2;

void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth);
servo1.attach(9);
servo2.attach(5);
}

BLYNK_WRITE(V4)

{
servo1.write(param.asInt());
servo2.write(param.asInt());
}

void loop()
{
Blynk.run();
}

I’ve changed my token before anyone says ;-0

Hi,

  1. Pls edit your post using code formatting
  2. Which widget do you use to control servos? Joystick?

What is code formatting? i want to use a Joystick widget.

http://docs.blynk.cc/#blynk-main-operations-send-data-from-app-to-hardware-sending-array-from-widget

I’m still having problems with this.

I would like to control one servo on X axis and attach it to pin 3 on my uno. i would then like to add another servo on pin 5 to control my Y axis. i have read the article but I’m still struggling. do i need to use virtual pins? how do i add them if so?

http://docs.blynk.cc/#widgets-common-widget-settings-splitmerge

This isn’t helping me I’ve read all that page. Please help

C’mon, documentation clearly states what you need :

BLYNK_WRITE(V4)
{
servo1.write(param[0].asInt()); //x
servo2.write(param[1].asInt()); //y
}

From docs:

SPLIT:
Each of the parameters is sent directly to the Pin on your hardware (e.g D7). You don’t need to write any code.

In this mode you send multiple commands from one widget, which can reduce performance of your hardware.
Example: If you have a Joystick Widget and it’s set to D3 and D4, it will send 2 commands over the Internet:

  digitalWrite(3, value);
  digitalWrite(4, value);

From docs:

MERGE:
When MERGE mode is selected, you are sending just 1 message, consisting of array of values. But you’ll need to parse it on the hardware.
This mode can be used with Virtual Pins only.

Thanks I’ve cracked it now!