Help us understand the problem. What is going on with this article?

ESP-32でメカナム 4WDを動かそう

ROTSONを作りましたが、手軽に動かせる子が欲しいので作ってみました。
なお、手軽に動かせる割に、製作は滅茶苦茶手がかかりました・・・
ROTSON ESP-32Power
当初TB6612FNGを2個使用した専用ボードを作りましたが
どうやってもストールしてしまうために、L293DDを使用した
NodeMCU ESP-32 MotorShield FULL IO Extension Boardを2個使用しました。
https://qiita.com/usashirou/items/4674ece87d452e71256c
ROTSON ESP-32Power
TB6612を2個使用した際に、どうしても電流が全く足りない状態になるのは、リークしているのか、
電流制限が入っていないのか不明ですが、L293DDを2個使用した場合には全く問題ありません。

ESP-32 MotorShield FULLとは、ジャンパーワイヤーでつないでいます。
また、NodeMCUに搭載している、ダイオードが1A品の為にNodeMCUが1個壊れてしまいました。
(2.5A程度は流れるバッテリーを使用しているので当然ですね)
このためもあり、バッテリーは、2個使用していますが、本来は1個でも動くはずです。
5Vのラインは、ダイオードの後ろにあります。

コードは以下を加工しています。
ESP32-DevKitを使ってWiFiコントロール・カーを製作(1)
http://mukujii.sakura.ne.jp/esp1.html

image.png

  /* WiFi-Control-Car */

  #include <WiFi.h>
const char* ssid     = "yokohama";      //アクセスポイントのSSID
const char* password = "12345678";     //アクセスポイントのパスワード
const char html[] =
    "<!DOCTYPE html><html lang='ja'><head><meta charset='UTF-8'>\
  <style>input {margin:8px;width:80px;}\
  div {font-size:16pt;color:red;text-align:center;width:400px;border:groove 40px orange;}</style>\
  <title>WiFi_Car Controller</title></head>\
  <body><div><p>Tank Controller</p>\
  <form method='get'>\
  <input type='submit' name='fl' value='斜左' />\
  <input type='submit' name='fo' value='前進' />\
  <input type='submit' name='fr' value='斜右' /><br>\
  <input type='submit' name='le' value='左' />\
  <input type='submit' name='st' value='停止' />\
  <input type='submit' name='ri' value='右' /><br>\
  <input type='submit' name='bl' value='斜左後' />\
  <input type='submit' name='ba' value='後退' />\
  <input type='submit' name='br' value='斜右後' /><br><br>\
  <input type='submit' name='tl' value='左回転' />\
  <input type='submit' name='tr' value='右回転' /><br>\
  </form></div></body></html>";

  void stop() {
    digitalWrite(12, LOW);
    digitalWrite(13, LOW);
    ledcWrite(0, 0);
    digitalWrite(25, LOW);
    digitalWrite(26, LOW);
    ledcWrite(1, 0);
    digitalWrite(15, LOW);
    digitalWrite(16, LOW);
    ledcWrite(2, 0);
    digitalWrite(18, LOW);
    digitalWrite(19, LOW);
    ledcWrite(3, 0);
  }

  WiFiServer server(80);

  void setup()
  {
    Serial.begin(115200);
  //右後
    pinMode(12, OUTPUT);
    pinMode(13, OUTPUT);
    pinMode(14, OUTPUT);
  //右前
    pinMode(15, OUTPUT);
    pinMode(16, OUTPUT);
    pinMode(17, OUTPUT);
  //左前 
    pinMode(18, OUTPUT);
    pinMode(19, OUTPUT);
    pinMode(21, OUTPUT);
  //左後 
    pinMode(25, OUTPUT);
    pinMode(26, OUTPUT);
    pinMode(27, OUTPUT);

    ledcSetup(0, 490, 8);
    ledcSetup(1, 490, 8);
    ledcSetup(2, 490, 8);
    ledcSetup(3, 490, 8);
    ledcAttachPin(14, 0);
    ledcAttachPin(27, 1);
    ledcAttachPin(17, 2);
    ledcAttachPin(21, 3);
    delay(10);

    Serial.println();
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
    }

    Serial.println("");
    Serial.println("WiFi connected.");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());

    server.begin();

  }

  void loop() {
    WiFiClient client = server.available();

    if (client) {
      Serial.println("New Client.");
      String currentLine = "";
      while (client.connected()) {
        if (client.available()) {
          char c = client.read();
          Serial.write(c);
          if (c == '\n') {
            if (currentLine.length() == 0) {
              client.println("HTTP/1.1 200 OK");
              client.println("Content-type:text/html");
              client.println();

              client.print(html);
              client.println();
              break;
            } else {
              currentLine = "";
            }
          } else if (c != '\r') {
            currentLine += c;
          }

          if (currentLine.endsWith("GET /?fo")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, HIGH);
            ledcWrite(0, 255);
            digitalWrite(25, LOW);
            digitalWrite(26, HIGH);
            ledcWrite(1, 255);
            digitalWrite(15, LOW);
            digitalWrite(16, HIGH);
            ledcWrite(2, 255);
            digitalWrite(18, LOW);
            digitalWrite(19, HIGH);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?fr")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, LOW);
            ledcWrite(0, 0);
            digitalWrite(25, LOW);
            digitalWrite(26, HIGH);
            ledcWrite(1, 255);
            digitalWrite(15, LOW);
            digitalWrite(16, LOW);
            ledcWrite(2, 0);
            digitalWrite(18, LOW);
            digitalWrite(19, HIGH);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?fl")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, HIGH);
            ledcWrite(0, 255);
            digitalWrite(25, LOW);
            digitalWrite(26, LOW);
            ledcWrite(1, 0);
            digitalWrite(15, LOW);
            digitalWrite(16, HIGH);
            ledcWrite(2, 255);
            digitalWrite(18, LOW);
            digitalWrite(19, LOW);
            ledcWrite(3, 0);
          }
          if (currentLine.endsWith("GET /?ri")) {
            stop();
            digitalWrite(12, HIGH);
            digitalWrite(13, LOW);
            ledcWrite(0, 255);
            digitalWrite(25, LOW);
            digitalWrite(26, HIGH);
            ledcWrite(1, 255);
            digitalWrite(15, HIGH);
            digitalWrite(16, LOW);
            ledcWrite(2, 255);
            digitalWrite(18, LOW);
            digitalWrite(19, HIGH);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?le")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, HIGH);
            ledcWrite(0, 255);
            digitalWrite(25, HIGH);
            digitalWrite(26, LOW);
            ledcWrite(1, 255);
            digitalWrite(15, LOW);
            digitalWrite(16, HIGH);
            ledcWrite(2, 255);
            digitalWrite(18, HIGH);
            digitalWrite(19, LOW);
            ledcWrite(3, 255);
          }

          if (currentLine.endsWith("GET /?ba")) {
            stop();
            digitalWrite(12, HIGH);
            digitalWrite(13, LOW);
            ledcWrite(0, 255);
            digitalWrite(25, HIGH);
            digitalWrite(26, LOW);
            ledcWrite(1, 255);
            digitalWrite(15, HIGH);
            digitalWrite(16, LOW);
            ledcWrite(2, 255);
            digitalWrite(18, HIGH);
            digitalWrite(19, LOW);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?br")) {
            stop();
            digitalWrite(12, HIGH);
            digitalWrite(13, LOW);
            ledcWrite(0, 255);
            digitalWrite(25, LOW);
            digitalWrite(26, LOW);
            ledcWrite(1, 0);
            digitalWrite(15, HIGH);
            digitalWrite(16, LOW);
            ledcWrite(2, 255);
            digitalWrite(18, LOW);
            digitalWrite(19, LOW);
            ledcWrite(3, 0);
          }
          if (currentLine.endsWith("GET /?bl")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, LOW);
            ledcWrite(0, 0);
            digitalWrite(25, HIGH);
            digitalWrite(26, LOW);
            ledcWrite(1, 255);
            digitalWrite(15, LOW);
            digitalWrite(16, LOW);
            ledcWrite(2, 0);
            digitalWrite(18, HIGH);
            digitalWrite(19, LOW);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?st")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, LOW);
            ledcWrite(0, 255);
            digitalWrite(25, LOW);
            digitalWrite(26, LOW);
            ledcWrite(1, 255);
            digitalWrite(15, LOW);
            digitalWrite(16, LOW);
            ledcWrite(2, 255);
            digitalWrite(18, LOW);
            digitalWrite(19, LOW);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?tr")) {
            stop();
            digitalWrite(12, LOW);
            digitalWrite(13, HIGH);
            ledcWrite(0, 255);
            digitalWrite(25, HIGH);
            digitalWrite(26, LOW);
            ledcWrite(1, 255);
            digitalWrite(15, HIGH);
            digitalWrite(16, LOW);
            ledcWrite(2, 255);
            digitalWrite(18, LOW);
            digitalWrite(19, HIGH);
            ledcWrite(3, 255);
          }
          if (currentLine.endsWith("GET /?tl")) {
            stop();
            digitalWrite(12, HIGH);
            digitalWrite(13, LOW);
            ledcWrite(0, 255);
            digitalWrite(25, LOW);
            digitalWrite(26, HIGH);
            ledcWrite(1, 255);
            digitalWrite(15, LOW);
            digitalWrite(16, HIGH);
            ledcWrite(2, 255);
            digitalWrite(18, HIGH);
            digitalWrite(19, LOW);
            ledcWrite(3, 255);
          }
        }
      }
      client.stop();
      Serial.println("Client Disconnected.");
    }
  }
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした