/*
-- 4wd --
//YOUTUBE.COM/LIGHTTUBES
//PONCOLHIJAU.WEB.ID
This source code of graphical user interface
has been generated automatically by RemoteXY editor.
To compile this code using RemoteXY library 3.1.6 or later version
download by link http://remotexy.com/en/library/
To connect using RemoteXY mobile app by link http://remotexy.com/en/download/
- for ANDROID 4.7.12 or later version;
- for iOS 1.4.7 or later version;
This source code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
*/
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,5,0,0,0,53,0,13,13,1,
1,1,42,47,12,12,2,31,84,0,
1,1,26,51,12,12,2,31,70,0,
1,1,26,75,12,12,2,31,66,0,
1,1,14,63,12,12,2,31,76,0,
1,1,38,63,12,12,2,31,82,0 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t button_t; // =1 if button pressed, else =0 //turning
uint8_t button_f; // =1 if button pressed, else =0 //forward
uint8_t button_b; // =1 if button pressed, else =0 //backward
uint8_t button_l; // =1 if button pressed, else =0
uint8_t button_r; // =1 if button pressed, else =0
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
//LIGHT================
//output to motor
#define mfr1 D5 //motor front right 1
#define mfr2 D6 //motor front right 2
#define mfl1 D7 //motor front left 1
#define mfl2 D8 //motor front left 2
#define mbr1 D1
#define mbr2 D2
#define mbl1 D3
#define mbl2 D4
//LIGHT================
void setup()
{
RemoteXY_Init ();
//LIGHT================
//output to motor
pinMode (mfr1, OUTPUT); //motor front right 1
pinMode (mfr2, OUTPUT); //motor front right 2
pinMode (mfl1, OUTPUT);
pinMode (mfl2, OUTPUT);
pinMode (mbr1, OUTPUT);
pinMode (mbr2, OUTPUT);
pinMode (mbl1, OUTPUT);
pinMode (mbl2, OUTPUT);
//LIGHT================
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
//LIGHT================
if (RemoteXY.button_f == HIGH) //forward
{
digitalWrite(mfr1, LOW);
digitalWrite(mfr2, HIGH);
digitalWrite(mbr1, LOW);
digitalWrite(mbr2, HIGH);
digitalWrite(mfl1, LOW);
digitalWrite(mfl2, HIGH);
digitalWrite(mbl1, LOW);
digitalWrite(mbl2, HIGH);
}
else if (RemoteXY.button_b == HIGH) //backward
{
digitalWrite(mfr1, HIGH);
digitalWrite(mfr2, LOW);
digitalWrite(mbr1, HIGH);
digitalWrite(mbr2, LOW);
digitalWrite(mfl1, HIGH);
digitalWrite(mfl2, LOW);
digitalWrite(mbl1, HIGH);
digitalWrite(mbl2, LOW);
}
else if (RemoteXY.button_l == HIGH) //slide left
{
digitalWrite(mfr1, LOW);
digitalWrite(mfr2, HIGH);
digitalWrite(mbr1, HIGH);
digitalWrite(mbr2, LOW);
digitalWrite(mfl1, HIGH);
digitalWrite(mfl2, LOW);
digitalWrite(mbl1, LOW);
digitalWrite(mbl2, HIGH);
}
else if (RemoteXY.button_r == HIGH) //slide right
{
digitalWrite(mfr1, HIGH);
digitalWrite(mfr2, LOW);
digitalWrite(mbr1, LOW);
digitalWrite(mbr2, HIGH);
digitalWrite(mfl1, LOW);
digitalWrite(mfl2, HIGH);
digitalWrite(mbl1, HIGH);
digitalWrite(mbl2, LOW);
}
else if (RemoteXY.button_t == HIGH) //turning
{
digitalWrite(mfr1, LOW);
digitalWrite(mfr2, HIGH);
digitalWrite(mbr1, LOW);
digitalWrite(mbr2, HIGH);
digitalWrite(mfl1, HIGH);
digitalWrite(mfl2, LOW);
digitalWrite(mbl1, HIGH);
digitalWrite(mbl2, LOW);
}
else {
digitalWrite(mfr1, LOW);
digitalWrite(mfr2, LOW);
digitalWrite(mbr1, LOW);
digitalWrite(mbr2, LOW);
digitalWrite(mfl1, LOW);
digitalWrite(mfl2, LOW);
digitalWrite(mbl1, LOW);
digitalWrite(mbl2, LOW);
}
}
//LIGHT================
// TODO you loop code
// use the RemoteXY structure for data transfer
// do not call delay()
Comments