Components and supplies
1
Dual H-Bridge motor drivers L298
1
Arduino UNO
1
DC Motor, 12 V
1
Wemos D1 Mini
Project description
Code
Code
arduino
1/* 2 -- remote control car wemos -- 3 4 This source code of graphical user interface 5 has been generated automatically by RemoteXY editor. 6 To compile this code using RemoteXY library 2.4.3 or later version 7 download by link http://remotexy.com/en/library/ 8 To connect using RemoteXY mobile app by link http://remotexy.com/en/download/ 9 - for ANDROID 4.5.1 or later version; 10 - for iOS 1.4.1 or later version; 11 12 This source code is free software; you can redistribute it and/or 13 modify it under the terms of the GNU Lesser General Public 14 License as published by the Free Software Foundation; either 15 version 2.1 of the License, or (at your option) any later version. 16*/ 17 18////////////////////////////////////////////// 19// RemoteXY include library // 20////////////////////////////////////////////// 21 22// RemoteXY select connection mode and include library 23#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT 24#include <ESP8266WiFi.h> 25 26#include <RemoteXY.h> 27 28// RemoteXY connection settings 29#define REMOTEXY_WIFI_SSID "LightTubes" 30#define REMOTEXY_WIFI_PASSWORD "12345678" 31#define REMOTEXY_SERVER_PORT 6377 32 33 34// RemoteXY configurate 35#pragma pack(push, 1) 36uint8_t RemoteXY_CONF[] = 37 { 255,4,0,0,0,43,0,10,164,0, 38 1,1,5,19,12,12,2,31,70,0, 39 1,1,5,33,12,12,2,31,66,0, 40 1,1,68,26,12,12,2,31,76,0, 41 1,1,82,26,12,12,2,31,82,0 }; 42 43// this structure defines all the variables and events of your control interface 44struct { 45 46 // input variables 47 uint8_t button_f; // =1 if button pressed, else =0 48 uint8_t button_b; // =1 if button pressed, else =0 49 uint8_t button_l; // =1 if button pressed, else =0 50 uint8_t button_r; // =1 if button pressed, else =0 51 52 // other variable 53 uint8_t connect_flag; // =1 if wire connected, else =0 54 55} RemoteXY; 56#pragma pack(pop) 57 58///////////////////////////////////////////// 59// END RemoteXY include // 60///////////////////////////////////////////// 61 62#define out1 D1 63#define out2 D2 64#define out3 D3 65#define out4 D4 66 67void setup() 68{ 69 RemoteXY_Init (); 70 71 pinMode (out1, OUTPUT); 72 pinMode (out2, OUTPUT); 73 pinMode (out3, OUTPUT); 74 pinMode (out4, OUTPUT); 75 76 // TODO you setup code 77 78} 79 80void loop() 81{ 82 RemoteXY_Handler (); 83 84 if (RemoteXY.button_f == HIGH){ //forward 85 digitalWrite(out1, HIGH); 86 digitalWrite(out2, LOW); 87 digitalWrite(out3, HIGH); 88 digitalWrite(out4, LOW); 89 } 90 else if (RemoteXY.button_b == HIGH){ //backward 91 digitalWrite(out1, LOW); 92 digitalWrite(out2, HIGH); 93 digitalWrite(out3, LOW); 94 digitalWrite(out4, HIGH); 95 } 96 else if (RemoteXY.button_l == HIGH){ //turn left 97 digitalWrite(out1, HIGH); 98 digitalWrite(out2, LOW); 99 digitalWrite(out3, LOW); 100 digitalWrite(out4, HIGH); 101 } 102 else if (RemoteXY.button_r == HIGH){ //turn right 103 digitalWrite(out1, LOW); 104 digitalWrite(out2, HIGH); 105 digitalWrite(out3, HIGH); 106 digitalWrite(out4, LOW); 107 } 108 else { 109 digitalWrite(out1, LOW); 110 digitalWrite(out2, LOW); 111 digitalWrite(out3, LOW); 112 digitalWrite(out4, LOW); 113 } 114 115 116 // TODO you loop code 117 // use the RemoteXY structure for data transfer 118 // do not call delay() 119 120 121}
Downloadable files
Schematic
Schematic
Schematic
Schematic
Comments
Only logged in users can leave comments