Hello, anyone can help me to explain how use BLE? I want to try use BLE Hm-10 with IOS, but when i want to connect my iphone with BLE, it’s always “can’t connect. please retry or choose another device.” (BLE widget setting). This widget already support for IOS? I used Iphone 6+, IOS 11.2.2, Blynk version 2.13.3, Library release 0.4.10. I’m try connect with LightBlue app, and manually (FTDI and AT-command), that’s works, but not with Blynk. This my sketch:
#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#define SerialBLE Serial2
//#include <SoftwareSerial.h>
//SoftwareSerial DebugSerial(16, 17); // RX, TX
//#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>
#include <Servo.h>
//char blynk
char auth[] = "YOUR AUTH";
//MOTOR PIN
int MOTOR1A = 22;
int MOTOR1B = 23;
int MOTOR2A = 24;
int MOTOR2B = 25;
int MOTOR3A = 30;
int MOTOR3B = 31;
int MOTOR4A = 32;
int MOTOR4B = 33;
int MOTOR5A = 28;
int MOTOR5B = 29;
int MOTOR6A = 26;
int MOTOR6B = 27;
//SPEED PIN
int MOTOR1 = 7;
int MOTOR2 = 6;
int MOTOR3 = 5;
int MOTOR4 = 4;
int MOTOR5 = 3;
int MOTOR6 = 2;
// SERVO
Servo SERVO1, SERVO2, SERVO3, SERVO4, SERVO5, SERVO6;
void setup() {
//BLYNK
// Debug console
SerialBLE.begin(9600);
SerialBLE.println("Waiting for connections...");
// Blynk will work through Serial
// Do not read or write this serial manually in your sketch
Serial.begin(9600);
Blynk.begin(SerialBLE, auth);
// SERVO PIN
SERVO1.attach(13);
SERVO2.attach(12);
SERVO3.attach(11);
SERVO4.attach(10);
SERVO5.attach(9);
SERVO6.attach(8);
//SERVO BEGIN
SERVO1.write(119);
SERVO2.write(37);
SERVO3.write(18);
SERVO4.write(87);
SERVO5.write(117);
SERVO6.write(55);
//MOTOR OUTPUT
pinMode(MOTOR1A, OUTPUT);
pinMode(MOTOR1B, OUTPUT);
pinMode(MOTOR2A, OUTPUT);
pinMode(MOTOR2B, OUTPUT);
pinMode(MOTOR3A, OUTPUT);
pinMode(MOTOR3B, OUTPUT);
pinMode(MOTOR4A, OUTPUT);
pinMode(MOTOR4B, OUTPUT);
pinMode(MOTOR5A, OUTPUT);
pinMode(MOTOR5B, OUTPUT);
pinMode(MOTOR6A, OUTPUT);
pinMode(MOTOR6B, OUTPUT);
//SPEED MOTOR OUTPUT
pinMode(MOTOR1, OUTPUT);
pinMode(MOTOR2, OUTPUT);
pinMode(MOTOR3, OUTPUT);
pinMode(MOTOR4, OUTPUT);
pinMode(MOTOR5, OUTPUT);
pinMode(MOTOR6, OUTPUT);
//MOTOR BEGIN
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, LOW);
}
void loop() {
Blynk.run();
}
BLYNK_WRITE(V0) {
const int X_THRESHOLD_LOW = 98; //x: 127 - 30
const int X_THRESHOLD_HIGH = 158; //x: 127 + 30
const int Y_THRESHOLD_LOW = 98; //y: 127 - 30
const int Y_THRESHOLD_HIGH = 158; //y: 127 + 30
int x_position = param[0].asInt(); //READ BLYNK JOYSTICK x_Position 0-255
int y_position = param[1].asInt(); //READ BLYNK JOYSTICK y_Position 0-255
int x_direction; //VARIABEL JOYSTICK DIRECTION: x= -1, 0, 1
int y_direction; //VARIABEL JOYSTICK DIRECTION: y= -1, 0, 1
Serial.print("x_position: ");
Serial.print(x_position);
Serial.print(" y_position: ");
Serial.println(y_position);
//JOYSTICK DIRECTION
//x_direction = 0;
//y_direction = 0;
if (x_position > X_THRESHOLD_HIGH) {
x_direction = 1;
} else if (x_position < X_THRESHOLD_LOW) {
x_direction = -1;
} else {
x_direction = 0;
}
if (y_position > Y_THRESHOLD_HIGH) {
y_direction = 1;
} else if (y_position < Y_THRESHOLD_LOW) {
y_direction = -1;
} else {
y_direction = 0;
}
if (x_direction == -1){
//x = -1 and y = -1 LEFT BACK
if (y_direction == -1) {
Serial.print("JOYSTICK: LEFT DOWN DIRECTION: LEFT BACK");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(145);
SERVO2.write(65);
SERVO3.write(0);
SERVO4.write(85);
SERVO5.write(90);
SERVO6.write(55);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,127);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,127);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,127);
analogWrite(MOTOR6,255);
}
//x = -1 and y = 0 TURN AROUND LEFT
else if (y_direction == 0) {
Serial.print("JOYSTICK: LEFT DIRECTION: TURN AROUND LEFT ");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(80);
SERVO2.write(85);
SERVO3.write(65);
SERVO4.write(87);
SERVO5.write(80);
SERVO6.write(55);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(100);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, HIGH);
digitalWrite(MOTOR6B, LOW );
analogWrite(MOTOR1,100);
analogWrite(MOTOR2,100);
analogWrite(MOTOR3,100);
analogWrite(MOTOR4,100);
analogWrite(MOTOR5,100);
analogWrite(MOTOR6,100);
}
//x = -1 and y = 1 LEFT FORWARD
else {
//y_direction == 1
Serial.print("JOYSTICK: UP LEFT DIRECTION: LEFT FORWARD");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(145);
SERVO2.write(65);
SERVO3.write(0);
SERVO4.write(85);
SERVO5.write(90);
SERVO6.write(55);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, HIGH);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,127);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,127);
analogWrite(MOTOR4,127);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
}
}
else if (x_direction == 0){
//x = 0 and y = -1 BACK
if (y_direction == -1) {
Serial.print("JOYSTICK: DOWN DIRECTION: BACK");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(119);
SERVO2.write(37);
SERVO3.write(18);
SERVO4.write(87);
SERVO5.write(117);
SERVO6.write(55);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
}
//x = 0 and y = 0 Stop
else if (y_direction == 0) {
Serial.print("JOYSTICK: MID DIRECTION: STOP");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(119);
SERVO2.write(37);
SERVO3.write(18);
SERVO4.write(87);
SERVO5.write(117);
SERVO6.write(55);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(100);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,0);
analogWrite(MOTOR2,0);
analogWrite(MOTOR3,0);
analogWrite(MOTOR4,0);
analogWrite(MOTOR5,0);
analogWrite(MOTOR6,0);
}
//x = 0 and y = 1 FORWARD
else {
//y_direction == 1
Serial.print("JOYSTICK: UP DIRECTION: FORWARD");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(119);
SERVO2.write(37);
SERVO3.write(18);
SERVO4.write(87);
SERVO5.write(117);
SERVO6.write(55);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, HIGH);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
}
}
else {//x_direction == 1
//x = 1 and y = -1 BACK RIGHT
if (y_direction == -1){
Serial.print("JOYSTICK: DOWN RIGHT DIRECTION: BACK RIGHT");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(90);
SERVO2.write(10);
SERVO3.write(50);
SERVO4.write(85);
SERVO5.write(155);
SERVO6.write(55);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,127);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,127);
analogWrite(MOTOR6,127);
}
//x = 1 and y = 0 TURN AROUND RIGHT
else if (y_direction == 0){
Serial.print("JOYSITCK: RIGHT DIRECTION: TURN AROUND RIGHT");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(80);
SERVO2.write(85);
SERVO3.write(65);
SERVO4.write(87);
SERVO5.write(80);
SERVO6.write(55);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(100);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,100);
analogWrite(MOTOR2,100);
analogWrite(MOTOR3,100);
analogWrite(MOTOR4,100);
analogWrite(MOTOR5,100);
analogWrite(MOTOR6,100);
}
//x = 1 and y = 1 RIGHT FORWARD
else {
//y_direction == 1
Serial.print("JOYSTICK: UP RIGHT DIRECTION: RIGHT FORWARD");
Serial.print(" x_direction ");
Serial.print(x_direction);
Serial.print(" y_direction ");
Serial.println(y_direction);
SERVO1.write(90);
SERVO2.write(10);
SERVO3.write(50);
SERVO4.write(85);
SERVO5.write(155);
SERVO6.write(55);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, HIGH);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,127);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,127);
analogWrite(MOTOR6,127);
}
}
}
BLYNK_WRITE(V1) //RIGHT
{
int pinValue = param.asInt(); // assigning incoming value from pin V3 to a variable
Serial.print("RIGHT: ");
Serial.println(pinValue);
if(pinValue == 1) {
SERVO1.write(32);
SERVO2.write(127);
SERVO3.write(105);
SERVO4.write(0);
SERVO5.write(27);
SERVO6.write(145);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(500);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, HIGH);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,128);
analogWrite(MOTOR2,128);
analogWrite(MOTOR3,128);
analogWrite(MOTOR4,128);
analogWrite(MOTOR5,128);
analogWrite(MOTOR6,128);
}
if(pinValue == 0) {
//STOP
SERVO1.write(119);
SERVO2.write(37);
SERVO3.write(18);
SERVO4.write(87);
SERVO5.write(117);
SERVO6.write(55);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(300);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,0);
analogWrite(MOTOR2,0);
analogWrite(MOTOR3,0);
analogWrite(MOTOR4,0);
analogWrite(MOTOR5,0);
analogWrite(MOTOR6,0);
}
}
BLYNK_WRITE(V2) //LEFT
{
int pinValue = param.asInt(); // assigning incoming value from pin V3 to a variable
Serial.print("LEFT: ");
Serial.println(pinValue);
if(pinValue == 1) {
SERVO1.write(32);
SERVO2.write(127);
SERVO3.write(105);
SERVO4.write(0);
SERVO5.write(27);
SERVO6.write(145);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, HIGH);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, HIGH);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, HIGH);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(500);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, HIGH);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, HIGH);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,128);
analogWrite(MOTOR2,128);
analogWrite(MOTOR3,128);
analogWrite(MOTOR4,128);
analogWrite(MOTOR5,128);
analogWrite(MOTOR6,128);
}
if(pinValue == 0) {
//STOP
SERVO1.write(119);
SERVO2.write(37);
SERVO3.write(18);
SERVO4.write(87);
SERVO5.write(117);
SERVO6.write(55);
digitalWrite(MOTOR1A, HIGH);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, HIGH);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, HIGH);
digitalWrite(MOTOR4A, HIGH);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, HIGH);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, HIGH);
analogWrite(MOTOR1,255);
analogWrite(MOTOR2,255);
analogWrite(MOTOR3,255);
analogWrite(MOTOR4,255);
analogWrite(MOTOR5,255);
analogWrite(MOTOR6,255);
delay(300);
digitalWrite(MOTOR1A, LOW);
digitalWrite(MOTOR1B, LOW);
digitalWrite(MOTOR2A, LOW);
digitalWrite(MOTOR2B, LOW);
digitalWrite(MOTOR3A, LOW);
digitalWrite(MOTOR3B, LOW);
digitalWrite(MOTOR4A, LOW);
digitalWrite(MOTOR4B, LOW);
digitalWrite(MOTOR5A, LOW);
digitalWrite(MOTOR5B, LOW);
digitalWrite(MOTOR6A, LOW);
digitalWrite(MOTOR6B, LOW);
analogWrite(MOTOR1,0);
analogWrite(MOTOR2,0);
analogWrite(MOTOR3,0);
analogWrite(MOTOR4,0);
analogWrite(MOTOR5,0);
analogWrite(MOTOR6,0);
}
}