Hello,
I connect Arduino one your server to serial connection.
When two full servo control can not establish the connection.
what is the problem?
I attach the code to put Arduino:
include SoftwareSerial.h
SoftwareSerial SwSerial(2, 3); // RX, TX
define BLYNK_PRINT SwSerial
include BlynkSimpleSerial.h>
include <Servo.h>
char auth[] = “”; //“YourAuthToken”
Servo servo9; //Variable que utilitzo pel servo connectat al pin 9
Servo servo10; //Variable que utilitzo pel servo connectat al pin 10
//************************************************************************
void setup()
{
SwSerial.begin(9600); //See the connection status in Serial Monitor
Blynk.begin(auth);
servo9.attach(9);//Dic on tinc connectat el servo (pin 9)
servo10.attach(10);
}
//************************************************************************
BLYNK_WRITE(3)
{
servo9.write(param.asInt());
}
BLYNK_WRITE(0)
{
servo10.write(180);
servo9.write(90);
}
BLYNK_WRITE(1)
{
servo10.write(0);
servo9.write(0);
}
void loop()
{
Blynk.run();
I reviewed the code, and it works fine. Attached below the new code.
I do not understand why it says to connect USB-serial adapter to see additional prints will SwSerial, I can explain more?, thank you.
In new code:
/JOSEP BOFARULL 13/07/2015 Nom de l’aplicació: ControlImaginaServos SERVO al pin D5 (DRET)control amb pulsadors virtuals SERVO al pin D6 (ESQUERRA) control amb pulsadors virtuals /
//*******************************************************************
//********************** LLIBRERIES I VARIABLES **************************
//************************************************************************
include SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
define BLYNK_PRINT SwSerial
include <BlynkSimpleSerial.h>
include <Servo.h>
char auth[] = “cfc6068…”; //“YourAuthToken”
Servo servo5; //Variable que utilitzo pel servo connectat al pin 5 (DRET)
Servo servo6; //Variable que utilitzo pel servo connectat al pin 6 (ESQUERRA)
int Endavant;
int Enrera;
int Dreta;
int Esquerra;
int Atura;
//************************************************************************
//********************** INICIALITZACIONS ********************************
//************************************************************************
void setup()
{
SwSerial.begin(9600); //See the connection status in Serial Monitor
Blynk.begin(auth);//Inicialitzo la comunicació amb el servidor Blynk
servo5.attach(5);//Dic on tinc connectat el servo (pin 5)
servo6.attach(6);
Endavant=0;
Enrera=0;
Dreta=0;
Esquerra=0;
Atura=0;
servo5.write(88);
servo6.write(90);
}
//************************************************************************
//********************** SUBRUTINES BLYNK ********************************
//************************************************************************
BLYNK_WRITE(0){Endavant=1;} //Pulsador virtual 0
BLYNK_WRITE(1){Enrera=1;} //Pulsador virtual 1
BLYNK_WRITE(2){Dreta=1;} //Pulsador virtual 2
BLYNK_WRITE(3){Esquerra=1;} //Pulsador virtual 3
BLYNK_WRITE(4){Atura=1;} //Pulsador virtual 4
//************************************************************************
//********************** PROGRAMA ****************************************
//************************************************************************
void loop()
{
Blynk.run(); //All the Blunk Magic happens here…
CONTROL_ROBOT_SERVOS();
}
//************************************************************************
//********************** SUBRUTINES **************************************
//************************************************************************
void CONTROL_ROBOT_SERVOS()//Moure 2 sercos al mateix temps amb pulsadors virtuals.
{
if (Endavant == 1){
servo5.write(0);
servo6.write(180);
Endavant=0;}
if (Enrera == 1){
servo5.write(180);
servo6.write(0);
Enrera=0;}
if (Dreta == 1){
servo5.write(88);
servo6.write(180);
Dreta=0;}
if (Esquerra == 1){
servo5.write(0);
servo6.write(90);
Esquerra=0;}
if (Atura == 1){
servo5.write(88);
servo6.write(90);
Atura=0;}
}
You have lots of live examples in your phone that are linked to the live GitHub and IDE examples.
Work through these basic examples to get connected to Blynk and then add the interesting parts like servos etc.
Ensure you always have the latest library version as old versions don’t work with the current server setup.