Hello.
I'm using an IoT platform with my ESP8266 called "Thinger.io"
It's similar to "Blynk" platform.
This is its sample code:
#include <ThingerESP8266.h>
#define USERNAME "erfan_m14"
#define DEVICE_ID "ESP8266"
#define DEVICE_CREDENTIAL "???????"
#define SSID "********"
#define SSID_PASSWORD "******"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
thing.add_wifi(SSID, SSID_PASSWORD);
// digital pin control example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
thing["led"] << digitalPin(LED_BUILTIN);
// resource output example (i.e. reading a sensor value)
thing["millis"] >> outputValue(millis());
// more details at http://docs.thinger.io/arduino/
}
void loop() {
thing.handle();
}
What I want to do is to use it with a motor driver with 2 motors to build a RC Car. So imagine I have 4 buttons on my phone browser (4 switches actually): Forward, Backward, Right and Left
Pins 1 and 2 control the right motor, pins 3 and 4 control the left motor.
When I turn on "forward" switch, both pins 2 and 4 should go HIGH, and When "backward" both pins 1 and 3 Should HIGH, for turning right pins 4 and 1 should go HIGH and to turn left, pins 2 and 3.
The problem is as you can see in the sample code, I should first set a pin for every button and then the library does the rest, I mean it knows when button is switched on, the pins should go HIGH, so just one pin for every button.
I think I can use 4 pins and every pin is connected to two inputs of the driver so each pin moves the car forward or backward or left or right.
But is there any solution to do my project without changing the wiring from Arduino to motor driver? I mean that every pin is connected to one input of the driver.