{"id":4155,"date":"2025-01-23T20:50:38","date_gmt":"2025-01-23T11:50:38","guid":{"rendered":"https:\/\/www.elehobby.fun\/?p=4155"},"modified":"2025-01-23T20:50:38","modified_gmt":"2025-01-23T11:50:38","slug":"esp32%e3%83%9c%e3%83%bc%e3%83%89%e3%81%a7%e5%88%b6%e5%be%a1%e3%81%95%e3%82%8c%e3%82%8b%e3%83%a9%e3%82%a4%e3%83%b3%e3%83%95%e3%82%a9%e3%83%ad%e3%83%af%e3%83%bc%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88","status":"publish","type":"post","link":"https:\/\/www.elehobby.fun\/?p=4155","title":{"rendered":"ESP32\u30dc\u30fc\u30c9\u3067\u5236\u5fa1\u3055\u308c\u308b\u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u30d7\u30e9\u30f3<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1- \u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8\u3068\u306f\u4f55\u3067\u3059\u304b?<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">2- ESP32\u30ab\u30fc\u30c9\u3067\u5236\u5fa1\u3055\u308c\u308b\u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8\u306e\u64cd\u4f5c<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">3- \u30ed\u30dc\u30c3\u30c8\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">4- \u30ed\u30dc\u30c3\u30c8\u306e\u53d6\u308a\u4ed8\u3051<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">5- Micropython \u3067 ESP32 \u30dc\u30fc\u30c9\u3092\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3059\u308b<\/h3>\n\n\n\n<h2 class=\"wp-block-heading\">\u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8\u3068\u306f\u4f55\u3067\u3059\u304b\uff1f<\/h2>\n\n\n\n<p>\u30e9\u30a4\u30f3<strong>\u30d5\u30a9\u30ed\u30ef\u30fc \u30ed\u30dc\u30c3\u30c8\u306f<\/strong>\u3001\u4e8b\u524d\u306b\u5b9a\u7fa9\u3055\u308c\u305f\u30d1\u30b9 (\u901a\u5e38\u306f\u8868\u9762\u306b\u63cf\u304b\u308c\u305f\u7dda) \u3092\u305f\u3069\u308b\u3088\u3046\u306b\u8a2d\u8a08\u3055\u308c\u305f\u81ea\u5f8b\u578b\u30ed\u30dc\u30c3\u30c8\u3067\u3059\u3002\u7dda\u306f\u901a\u5e38\u3001\u767d\u3044\u8868\u9762\u4e0a\u306e\u9ed2\u3044\u7dda\u3001\u307e\u305f\u306f\u9ed2\u3044\u8868\u9762\u4e0a\u306e\u767d\u3044\u7dda\u3067\u3059\u3002\u30ed\u30dc\u30c3\u30c8\u306f\u30bb\u30f3\u30b5\u30fc\u3092\u4f7f\u7528\u3057\u3066\u7dda\u3092\u691c\u51fa\u3057\u3001\u30d1\u30b9\u4e0a\u306b\u3068\u3069\u307e\u308b\u3088\u3046\u306b\u52d5\u304d\u3092\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u4ed5\u7d44\u307f:<\/strong><\/h3>\n\n\n\n<p><strong>\u30bb\u30f3\u30b5\u30fc:<\/strong><\/p>\n\n\n\n<p>\u7dda\u3068\u8868\u9762\u306e\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u3092\u691c\u51fa\u3059\u308b\u305f\u3081\u306b\u3001\u8d64\u5916\u7dda (IR) \u30bb\u30f3\u30b5\u30fc\u307e\u305f\u306f\u5149\u4f9d\u5b58\u62b5\u6297\u5668 (LDR) \u304c\u4e00\u822c\u7684\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u306e\u30d9\u30fc\u30b9\u306b\u30bb\u30f3\u30b5\u30fc\u304c\u914d\u7f6e\u3055\u308c\u3066\u304a\u308a\u3001\u8868\u9762\u3092\u7d99\u7d9a\u7684\u306b\u30b9\u30ad\u30e3\u30f3\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30bb\u30f3\u30b5\u30fc\u304c\u7dda\uff08\u9ad8\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\uff09\u3092\u691c\u51fa\u3059\u308b\u3068\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u4fe1\u53f7\u3092\u9001\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\uff1a<\/strong><\/p>\n\n\n\n<p>\u30de\u30a4\u30af\u30ed\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9 (Arduino\u3001Raspberry Pi\u3001\u305d\u306e\u4ed6\u306e\u7d44\u307f\u8fbc\u307f\u30b7\u30b9\u30c6\u30e0\u306a\u3069) \u304c\u30bb\u30f3\u30b5\u30fc \u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3057\u3066\u6c7a\u5b9a\u3092\u4e0b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u304c\u30e9\u30a4\u30f3\u306b\u6cbf\u3063\u3066\u79fb\u52d5\u3057\u7d9a\u3051\u308b\u305f\u3081\u306b\u3069\u306e\u3088\u3046\u306b\u79fb\u52d5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3092\u8a08\u7b97\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u30e2\u30fc\u30bf\u30fc\u3068\u30a2\u30af\u30c1\u30e5\u30a8\u30fc\u30bf:<\/strong><\/p>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u306f DC \u30e2\u30fc\u30bf\u30fc\u307e\u305f\u306f\u30b5\u30fc\u30dc \u30e2\u30fc\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u8eca\u8f2a\u3092\u99c6\u52d5\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u6307\u793a\u306b\u57fa\u3065\u3044\u3066\u3001\u30e2\u30fc\u30bf\u30fc\u304c\u30ed\u30dc\u30c3\u30c8\u306e\u65b9\u5411\u3092\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\uff1a<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u57fa\u672c\u7684\u306a\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3067\u306f\u3001\u300c\u5de6\u306e\u30bb\u30f3\u30b5\u30fc\u304c\u7dda\u3092\u691c\u51fa\u3057\u305f\u5834\u5408\u306f\u5de6\u306b\u66f2\u304c\u308a\u3001\u53f3\u306e\u30bb\u30f3\u30b5\u30fc\u304c\u7dda\u3092\u691c\u51fa\u3057\u305f\u5834\u5408\u306f\u53f3\u306b\u66f2\u304c\u308b\u300d\u306a\u3069\u306e\u6761\u4ef6\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u9ad8\u5ea6\u306a\u30ed\u30dc\u30c3\u30c8\u3067\u306f\u3001\u3088\u308a\u30b9\u30e0\u30fc\u30ba\u3067\u6b63\u78ba\u306a\u30e9\u30a4\u30f3\u8ffd\u5f93\u3092\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306b\u3001PID (\u6bd4\u4f8b\u30fb\u7a4d\u5206\u30fb\u5fae\u5206) \u5236\u5fa1\u304c\u4f7f\u7528\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ESP32\u30ab\u30fc\u30c9\u3067\u5236\u5fa1\u3055\u308c\u308b\u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8\u306e\u64cd\u4f5c<\/h2>\n\n\n\n<p><strong>ESP32<\/strong>\u30de\u30a4\u30af\u30ed\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306b\u3088\u3063\u3066\u5236\u5fa1\u3055\u308c\u308b 2 \u3064\u306e\u8eca\u8f2a\u3092\u5099\u3048\u305f<strong>\u30e9\u30a4\u30f3 \u30d5\u30a9\u30ed\u30ef\u30fc \u30ed\u30dc\u30c3\u30c8\u306f<\/strong>\u3001\u30e9\u30a4\u30f3\u691c\u51fa\u7528\u306e2 \u3064\u306e<strong>KY-032 \u30bb\u30f3\u30b5\u30fc\u3068\u30e2\u30fc\u30bf\u30fc\u5236\u5fa1\u7528\u306e<\/strong><strong>L298N \u30e2\u30fc\u30bf\u30fc \u30c9\u30e9\u30a4\u30d0\u30fc \u30e2\u30b8\u30e5\u30fc\u30eb<\/strong>\u3092\u4f7f\u7528\u3057\u3066\u3001\u8868\u9762\u4e0a\u306e\u30e9\u30a4\u30f3\u306e\u52d5\u304d\u3092\u7d99\u7d9a\u7684\u306b\u611f\u77e5\u3057\u3066\u8abf\u6574\u3059\u308b\u3053\u3068\u3067\u3001\u30e9\u30a4\u30f3\u3092\u305f\u3069\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001\u52d5\u4f5c\u306e\u8a73\u7d30\u306a\u8aac\u660e\u3067\u3059\u3002<strong><\/strong><strong><\/strong><strong><\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. \u30bb\u30f3\u30b5\u30fc\u306e\u52d5\u4f5c:<\/strong><\/h4>\n\n\n\n<p>\u5404 KY-032 \u30bb\u30f3\u30b5\u30fc\u306f\u8d64\u5916\u7dda\u3092\u653e\u5c04\u3057\u3001\u53cd\u5c04\u5149\u3092\u6e2c\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u6697\u3044\u7dda\u306f<\/strong>IR\u5149\u3092\u5438\u53ce\u3057\u307e\u3059 (\u53cd\u5c04\u304c\u4f4e\u3044\u3001\u4fe1\u53f7 = LOW)\u3002<\/p>\n\n\n\n<p><strong>\u660e\u308b\u3044\u8868\u9762\u306f<\/strong>IR\u5149\u3092\u53cd\u5c04\u3057\u307e\u3059 (\u9ad8\u53cd\u5c04\u3001\u4fe1\u53f7 = HIGH)\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. ESP32\u306b\u3088\u308b\u610f\u601d\u6c7a\u5b9a:<\/strong><\/h4>\n\n\n\n<p>ESP32 \u306f\u30bb\u30f3\u30b5\u30fc\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u53d6\u308a\u3001\u52d5\u304d\u3092\u6c7a\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u4e21\u65b9\u306e\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u3092\u691c\u51fa\uff08L=LOW\u3001R=LOW\uff09\uff1a<\/strong>\u30ed\u30dc\u30c3\u30c8\u306f<strong>\u524d\u9032<\/strong>\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u5de6\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u3092\u691c\u51fa (L=LOW\u3001R=HIGH):<\/strong>\u30ed\u30dc\u30c3\u30c8\u306f<strong>\u5de6\u306b<\/strong>\u56de\u8ee2\u3057\u3066\u30e9\u30a4\u30f3\u306b\u623b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u53f3\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u3092\u691c\u51fa (L=HIGH\u3001R=LOW):<\/strong>\u30ed\u30dc\u30c3\u30c8\u306f<strong>\u53f3\u306b<\/strong>\u56de\u8ee2\u3057\u3066\u30e9\u30a4\u30f3\u306b\u623b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u4e21\u65b9\u306e\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u304b\u3089\u5916\u308c\u3066\u3044\u308b (L=HIGH\u3001R=HIGH):<\/strong>\u30ed\u30dc\u30c3\u30c8\u306f\u505c\u6b62\u3059\u308b\u304b\u3001\u308f\u305a\u304b\u306b\u56de\u8ee2\u3057\u3066\u30e9\u30a4\u30f3\u3092\u691c\u7d22\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. L298N\u306b\u3088\u308b\u30e2\u30fc\u30bf\u30fc\u5236\u5fa1:<\/strong><\/h4>\n\n\n\n<p>L298N \u306f ESP32 \u304b\u3089\u4fe1\u53f7\u3092\u53d7\u4fe1\u3057\u3066\u200b\u200b\u30e2\u30fc\u30bf\u30fc\u306e\u65b9\u5411\u3068\u901f\u5ea6\u3092\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u524d\u9032<\/strong>\uff1a\u4e21\u65b9\u306e\u30e2\u30fc\u30bf\u30fc\u304c\u524d\u9032\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u5de6\u6298<\/strong>: \u53f3\u30e2\u30fc\u30bf\u30fc\u3092\u6e1b\u901f\/\u505c\u6b62\u3057\u3001\u5de6\u30e2\u30fc\u30bf\u30fc\u3092\u52d5\u304b\u3057\u7d9a\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u53f3\u6298<\/strong>: \u5de6\u306e\u30e2\u30fc\u30bf\u30fc\u3092\u6e1b\u901f\/\u505c\u6b62\u3057\u3001\u53f3\u306e\u30e2\u30fc\u30bf\u30fc\u3092\u52d5\u304b\u3057\u7d9a\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u505c\u6b62<\/strong>\uff1a\u4e21\u65b9\u306e\u30e2\u30fc\u30bf\u30fc\u3092\u505c\u6b62\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30ed\u30dc\u30c3\u30c8\u90e8\u54c1<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>ESP32 \u30de\u30a4\u30af\u30ed\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.robotique.site\/wp-content\/uploads\/2023\/05\/ESP32-1.png\" alt=\"ESP32 \u30ab\u30fc\u30c9\" class=\"wp-image-808\"\/><\/figure>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u306e\u982d\u8133\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u30bb\u30f3\u30b5\u30fc\u304b\u3089\u306e\u5165\u529b\u3092\u51e6\u7406\u3057\u3001\u30e2\u30fc\u30bf\u30fc\u5236\u5fa1\u4fe1\u53f7\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>KY-032 \u30bb\u30f3\u30b5\u30fc\uff08\u8d64\u5916\u7dda\u969c\u5bb3\u7269\u30bb\u30f3\u30b5\u30fc\uff09\uff1a<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.robotique.site\/wp-content\/uploads\/2023\/07\/capteur-ky032-1.jpg\" alt=\"KY-032 \u8d64\u5916\u7dda\u30bb\u30f3\u30b5\u30fc\u30e2\u30b8\u30e5\u30fc\u30eb\" class=\"wp-image-1229\"\/><\/figure>\n\n\n\n<p>IR \u53cd\u5c04\u306b\u57fa\u3065\u3044\u3066\u7dda\u3068\u8868\u9762\u3092\u533a\u5225\u3057\u3066\u7dda\u3092\u691c\u51fa\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u306e\u524d\u9762\u306b\u914d\u7f6e:<\/p>\n\n\n\n<p><strong>\u5de6\u30bb\u30f3\u30b5\u30fc\uff08L\uff09<\/strong>\uff1a\u30e9\u30a4\u30f3\u306e\u5de6\u5074\u3092\u691c\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>\u53f3\u30bb\u30f3\u30b5\u30fc\uff08R\uff09<\/strong>\uff1a\u30e9\u30a4\u30f3\u306e\u53f3\u5074\u3092\u691c\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>L298N \u30e2\u30fc\u30bf\u30fc \u30c9\u30e9\u30a4\u30d0\u30fc \u30e2\u30b8\u30e5\u30fc\u30eb:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.robotique.tech\/wp-content\/uploads\/2022\/11\/Module_L298N.png\" alt=\"\" class=\"wp-image-4593\"\/><\/figure>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u306e\u8eca\u8f2a\u306b\u63a5\u7d9a\u3055\u308c\u305f 2 \u3064\u306e DC \u30e2\u30fc\u30bf\u30fc\u3092\u5236\u5fa1\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30e2\u30fc\u30bf\u30fc\u306e\u53cc\u65b9\u5411\u5236\u5fa1\uff08\u524d\u9032\u3001\u5f8c\u9032\u3001\u5de6\u6298\/\u53f3\u6298\uff09\u3092\u53ef\u80fd\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>DC\u30e2\u30fc\u30bf\u30fc:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.robotique.tech\/wp-content\/uploads\/2022\/11\/kit-robot-2-roues.jpg\" alt=\"\" class=\"wp-image-4595\"\/><\/figure>\n\n\n\n<p>\u30ed\u30dc\u30c3\u30c8\u306b\u52d5\u304d\u3092\u4e0e\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<p>https:\/\/googleads.g.doubleclick.net\/pagead\/ads?client=ca-pub-<\/p>\n\n\n\n<p>L298N \u30e2\u30b8\u30e5\u30fc\u30eb\u304b\u3089\u306e\u4fe1\u53f7\u306b\u57fa\u3065\u3044\u3066\u901f\u5ea6\u3084\u65b9\u5411\u3092\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u96fb\u6e90<\/strong>\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.robotique.tech\/wp-content\/uploads\/2022\/04\/battery_9v.png\" alt=\"\" width=\"153\" height=\"230\"><\/h3>\n\n\n\n<p>\u30d0\u30c3\u30c6\u30ea\u30fc\u306f ESP32\u3001\u30e2\u30fc\u30bf\u30fc \u30c9\u30e9\u30a4\u30d0\u30fc\u3001\u304a\u3088\u3073\u30e2\u30fc\u30bf\u30fc\u306b\u96fb\u529b\u3092\u4f9b\u7d66\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30ed\u30dc\u30c3\u30c8\u306e\u53d6\u308a\u4ed8\u3051<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.robotique.site\/wp-content\/uploads\/2024\/11\/esp32-suiveur-ligne.jpg\" alt=\"\" class=\"wp-image-6707\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.robotique.site\/wp-content\/uploads\/2024\/11\/Montage_robot_suiveur_ESP32_2.jpg\" alt=\"\" width=\"616\" height=\"462\" srcset=\"https:\/\/www.robotique.site\/wp-content\/uploads\/2024\/11\/Montage_robot_suiveur_ESP32_2.jpg 816w, https:\/\/www.robotique.site\/wp-content\/uploads\/2024\/11\/Montage_robot_suiveur_ESP32_2-300x225.jpg 300w, https:\/\/www.robotique.site\/wp-content\/uploads\/2024\/11\/Montage_robot_suiveur_ESP32_2-768x576.jpg 768w\"><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>KY-032 \u30bb\u30f3\u30b5\u30fc\u3092 ESP32 \u306b\u63a5\u7d9a:<\/strong><\/h4>\n\n\n\n<p><strong>VCC<\/strong>&nbsp;\u2192 ESP32\u304b\u30893.3V\u3002<\/p>\n\n\n\n<p><strong>GND<\/strong>&nbsp;\u2192 ESP32\u306eGND\u3002<\/p>\n\n\n\n<p><strong>OUT\uff08\u5de6\u30bb\u30f3\u30b5\u30fc\uff09<\/strong>&nbsp;\u2192GPIO\u30d4\u30f3D25\u3002<\/p>\n\n\n\n<p><strong>OUT\uff08\u53f3\u30bb\u30f3\u30b5\u30fc\uff09<\/strong>&nbsp;\u2192GPIO\u30d4\u30f3D26\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>ESP32\u304b\u3089L298N\u3078:<\/strong><\/h4>\n\n\n\n<p><strong>IN1\uff08L298N\uff09<\/strong>&nbsp;\u2192GPIO\u30d4\u30f3D4\uff08\u5de6\u30e2\u30fc\u30bf\u30fc\u65b9\u5411\u5236\u5fa1\uff09\u3002<\/p>\n\n\n\n<p><strong>IN2\uff08L298N\uff09<\/strong>&nbsp;\u2192GPIO\u30d4\u30f3D5\uff08\u5de6\u30e2\u30fc\u30bf\u30fc\u65b9\u5411\u5236\u5fa1\uff09\u3002<\/p>\n\n\n\n<p><strong>IN3 (L298N)<\/strong>&nbsp;\u2192 GPIO \u30d4\u30f3 D18 (\u53f3\u30e2\u30fc\u30bf\u30fc\u65b9\u5411\u5236\u5fa1)\u3002<\/p>\n\n\n\n<p><strong>IN4 (L298N)<\/strong>&nbsp;\u2192 GPIO \u30d4\u30f3 D19 (\u53f3\u30e2\u30fc\u30bf\u30fc\u65b9\u5411\u5236\u5fa1)\u3002<\/p>\n\n\n\n<p><strong>ENA (L298N)<\/strong>&nbsp;\u2192 PWM\u5bfe\u5fdc\u30d4\u30f3D32 (\u5de6\u30e2\u30fc\u30bf\u30fc\u901f\u5ea6\u5236\u5fa1)\u3002<\/p>\n\n\n\n<p><strong>ENB (L298N)<\/strong>&nbsp;\u2192 PWM\u5bfe\u5fdc\u30d4\u30f3D33 (\u53f3\u30e2\u30fc\u30bf\u30fc\u901f\u5ea6\u5236\u5fa1)\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>L298N\u306e\u30e2\u30fc\u30bf\u30fc:<\/strong><\/h4>\n\n\n\n<p><strong>OUT1\u3001OUT2<\/strong>&nbsp;\u2192 \u5de6\u30e2\u30fc\u30bf\u30fc\u7aef\u5b50\u3002<\/p>\n\n\n\n<p><strong>OUT3\u3001OUT4<\/strong>&nbsp;\u2192 \u53f3\u30e2\u30fc\u30bf\u30fc\u7aef\u5b50\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>\u96fb\u6e90\uff1a<\/strong><\/h4>\n\n\n\n<p><strong>ESP32<\/strong>&nbsp;: USB \u307e\u305f\u306f\u30d0\u30c3\u30c6\u30ea\u30fc (\u4f8b: 3.7V LiPo) \u304b\u3089\u96fb\u6e90\u3092\u4f9b\u7d66\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>L298N<\/strong>&nbsp;: 6\uff5e12V \u306e\u5916\u90e8\u30d0\u30c3\u30c6\u30ea\u30fc\u304b\u3089\u96fb\u529b\u3092\u4f9b\u7d66\u3055\u308c\u3001\u30e2\u30fc\u30bf\u30fc\u3092\u99c6\u52d5\u3057\u307e\u3059 (L298N \u306e VIN \u7aef\u5b50\u3068 GND \u7aef\u5b50\u306b\u63a5\u7d9a\u3057\u307e\u3059)\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Micropython \u3067 ESP32 \u30dc\u30fc\u30c9\u3092\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3059\u308b<\/h2>\n\n\n\n<p>ESP32 \u306f\u30bb\u30f3\u30b5\u30fc \u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3057\u3001\u30e2\u30fc\u30bf\u30fc\u3092\u5236\u5fa1\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u30b5\u30f3\u30d7\u30eb \u30b3\u30fc\u30c9\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/www.robotique.site\/wp-content\/uploads\/2024\/04\/DCMotor.py\">2 \u3064\u306e\u30e2\u30fc\u30bf\u30fc\u3092\u5236\u5fa1\u3059\u308b\u306b\u306f\u3001 DCMotor.py<\/a><\/strong>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from machine import Pin, ADC , PWMfrom time \nimport sleepfrom DCMotor \nimport DCMotor \nline1 = ADC(Pin(34))line2 = ADC(Pin(35))frequency = 15000\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \npin1 = Pin(22, Pin.OUT)\u00a0\u00a0\u00a0\u00a0\npin2 = Pin(21, Pin.OUT)\u00a0\u00a0\npin3 = Pin(19, Pin.OUT)\u00a0\u00a0\u00a0\u00a0\npin4 = Pin(18, Pin.OUT)\u00a0\u00a0\nenable = PWM(Pin(23), frequency)\u00a0\u00a0\nenable1 = PWM(Pin(5), frequency)\ndc_motor = DCMotor(pin1, pin2, enable)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\ndc_motor = DCMotor(pin1, pin2, enable, 350, 1023)\ndc_motor1 = DCMotor(pin3, pin4, enable1)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\ndc_motor1 = DCMotor(pin3, pin4, enable1, 350, 1023)\n\nwhile True:\u00a0\u00a0line1_value = line1.read()\u00a0\u00a0\nline2_value = line2.read()\u00a0\u00a0\nprint('motor1=',line1_value)\u00a0\u00a0\nprint('motor2=',line2_value)\u00a0\u00a0if (line1_value &lt; 1000) : \u00a0\u00a0\u00a0\u00a0dc_motor.forward(10) # Turn &lt;strong>right&lt;\/strong>\u00a0\u00a0\u00a0\u00a0dc_motor1.forward(90)\u00a0\u00a0if (line2_value &lt; 1000) :\u00a0\u00a0\u00a0\u00a0dc_motor1.forward(10) # Turn &lt;strong>left&lt;\/strong>\u00a0\u00a0\u00a0\u00a0dc_motor.forward(90)\u00a0\u00a0if (line1_value > 1000) and (line2_value > 1000) :\u00a0\u00a0\u00a0\u00a0dc_motor.forward(75) # Move &lt;strong>forward&lt;\/strong>\u00a0\u00a0\u00a0\u00a0dc_motor1.forward(75)\u00a0\u00a0\u00a0\u00a0sleep(0.1)\u00a0\u00a0\u00a0\u00a0dc_motor.forward(10)\u00a0\u00a0\u00a0\u00a0dc_motor1.forward(10)\u00a0\u00a0\u00a0\u00a0sleep(0.2)\u00a0\u00a0if (line1_value &lt; 1000) and (line2_value &lt; 1000) :\u00a0\u00a0\u00a0\u00a0\ndc_motor.stop() \u00a0\u00a0\u00a0\u00a0\ndc_motor1.stop()<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. \u30bb\u30f3\u30b5\u30fc\u30ed\u30b8\u30c3\u30af:<\/strong><\/h4>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u904b\u55b6\u539f\u5247<\/strong><\/h3>\n\n\n\n<p>2 \u3064\u306e KY-032 \u30bb\u30f3\u30b5\u30fc\u306f\u3001\u30ed\u30dc\u30c3\u30c8\u306e\u524d\u90e8\u3001\u5730\u9762\u8fd1\u304f\u306b\u914d\u7f6e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305d\u308c\u3089\u306e\u51fa\u529b\u306f ESP32 \u306b\u3088\u3063\u3066\u8aad\u307f\u53d6\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u5de6\u30bb\u30f3\u30b5\u30fc\uff08L\uff09\u306f<\/strong>\u30e9\u30a4\u30f3\u306e\u5de6\u5074\u3092\u76e3\u8996\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u53f3\u30bb\u30f3\u30b5\u30fc\uff08R\uff09\u306f<\/strong>\u30e9\u30a4\u30f3\u306e\u53f3\u5074\u3092\u76e3\u8996\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30bb\u30f3\u30b5\u30fc\u5024\u306f\u3001\u6b21\u306e\u6761\u4ef6\u306b\u57fa\u3065\u3044\u3066\u30ed\u30dc\u30c3\u30c8\u306e\u52d5\u304d\u3092\u30ac\u30a4\u30c9\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>(line1_value &gt; 1000) \u304b\u3064 (line2_value &gt; 1000): \u4e21\u65b9\u306e\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u4e0a\u306b\u3042\u308b \u2192<strong>\u524d\u9032<\/strong>\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>(line2_value &lt; 1000): \u5de6\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u4e0a\u3001\u53f3\u30bb\u30f3\u30b5\u30fc\u304c\u30aa\u30d5 \u2192<strong>\u5de6\u306b<\/strong>\u66f2\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>(line1_value &lt; 1000): \u53f3\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u4e0a\u3001\u5de6\u30bb\u30f3\u30b5\u30fc\u304c\u30aa\u30d5 \u2192<strong>\u53f3\u306b<\/strong>\u66f2\u304c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>(line1_value &gt; 1000) \u304b\u3064 (line2_value &gt; 1000): \u4e21\u65b9\u306e\u30bb\u30f3\u30b5\u30fc\u304c\u30e9\u30a4\u30f3\u304b\u3089\u5916\u308c\u3066\u3044\u307e\u3059 \u2192<strong>\u505c\u6b62\u3057\u307e\u3059<\/strong>\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. L298N\u306b\u3088\u308b\u30e2\u30fc\u30bf\u30fc\u5236\u5fa1:<\/strong><\/h4>\n\n\n\n<p>ESP32 \u306f L298N \u306b\u5236\u5fa1\u4fe1\u53f7\u3092\u9001\u4fe1\u3057\u3066\u3001\u30e2\u30fc\u30bf\u30fc\u306e\u65b9\u5411\u3068\u901f\u5ea6\u3092\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u524d\u9032<\/strong>\uff1a\u4e21\u65b9\u306e\u30e2\u30fc\u30bf\u30fc\u304c\u524d\u65b9\u306b\u56de\u8ee2\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u5de6\u306b\u66f2\u304c\u308b<\/strong>: \u5de6\u306e\u30e2\u30fc\u30bf\u30fc\u306f\u6e1b\u901f\u307e\u305f\u306f\u505c\u6b62\u3057\u3001\u53f3\u306e\u30e2\u30fc\u30bf\u30fc\u306f\u524d\u9032\u3057\u7d9a\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u53f3\u306b\u66f2\u304c\u308b<\/strong>: \u53f3\u5074\u306e\u30e2\u30fc\u30bf\u30fc\u306f\u6e1b\u901f\u307e\u305f\u306f\u505c\u6b62\u3057\u3001\u5de6\u5074\u306e\u30e2\u30fc\u30bf\u30fc\u306f\u524d\u9032\u3057\u7d9a\u3051\u307e\u3059\u3002<\/p>\n\n\n\n<p><strong>\u505c\u6b62<\/strong>\uff1a\u4e21\u65b9\u306e\u30e2\u30fc\u30bf\u30fc\u304c\u505c\u6b62\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n<div class=\"veu_socialSet veu_socialSet-position-after veu_contentAddSection\"><script>window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src=\"https:\/\/platform.twitter.com\/widgets.js\";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,\"script\",\"twitter-wjs\"));<\/script><ul><li class=\"sb_facebook sb_icon\"><a class=\"sb_icon_inner\" href=\"\/\/www.facebook.com\/sharer.php?src=bm&u=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4155&amp;t=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\" onclick=\"window.open(this.href,'FBwindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_fb icon_sns\"><\/span><span class=\"sns_txt\">Facebook<\/span><span class=\"veu_count_sns_fb\"><\/span><\/a><\/li><li class=\"sb_twitter sb_icon\"><a class=\"sb_icon_inner\" href=\"\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4155&amp;text=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\" ><span class=\"vk_icon_w_r_sns_twitter icon_sns\"><\/span><span class=\"sns_txt\">twitter<\/span><\/a><\/li><li class=\"sb_hatena sb_icon\"><a class=\"sb_icon_inner\" href=\"\/\/b.hatena.ne.jp\/add?mode=confirm&url=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4155&amp;title=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\"  onclick=\"window.open(this.href,'Hatenawindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_hatena icon_sns\"><\/span><span class=\"sns_txt\">Hatena<\/span><span class=\"veu_count_sns_hb\"><\/span><\/a><\/li><li class=\"sb_pocket sb_icon\"><a class=\"sb_icon_inner\"  href=\"\/\/getpocket.com\/edit?url=https%3A%2F%2Fwww.elehobby.fun%2F%3Fp%3D4155&title=%E5%AE%9F%E8%B7%B5%E3%81%A7%E3%81%8D%E3%81%9F%E9%9B%BB%E5%AD%90%E5%B7%A5%E4%BD%9C%E3%81%A8%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E9%96%8B%E7%99%BA\" target=\"_blank\"  onclick=\"window.open(this.href,'Pokcetwindow','width=650,height=450,menubar=no,toolbar=no,scrollbars=yes');return false;\"><span class=\"vk_icon_w_r_sns_pocket icon_sns\"><\/span><span class=\"sns_txt\">Pocket<\/span><span class=\"veu_count_sns_pocket\"><\/span><\/a><\/li><li class=\"sb_copy sb_icon\"><button class=\"copy-button sb_icon_inner\"data-clipboard-text=\"\u5b9f\u8df5\u3067\u304d\u305f\u96fb\u5b50\u5de5\u4f5c\u3068\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u958b\u767a https:\/\/www.elehobby.fun\/?p=4155\"><span class=\"vk_icon_w_r_sns_copy icon_sns\"><i class=\"fas fa-copy\"><\/i><\/span><span class=\"sns_txt\">Copy<\/span><\/button><\/li><\/ul><\/div><!-- [ \/.socialSet ] -->","protected":false},"excerpt":{"rendered":"<p>\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u30d7\u30e9\u30f3 1- \u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8\u3068\u306f\u4f55\u3067\u3059\u304b? 2- ESP32\u30ab\u30fc\u30c9\u3067\u5236\u5fa1\u3055\u308c\u308b\u30e9\u30a4\u30f3\u30d5\u30a9\u30ed\u30ef\u30fc\u30ed\u30dc\u30c3\u30c8\u306e\u64cd\u4f5c 3- \u30ed\u30dc\u30c3\u30c8\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8 4- \u30ed\u30dc\u30c3\u30c8\u306e\u53d6\u308a\u4ed8\u3051 5- Micropython [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[16],"tags":[],"class_list":["post-4155","post","type-post","status-publish","format-standard","hentry","category-electronicswork"],"_links":{"self":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts\/4155","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4155"}],"version-history":[{"count":1,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts\/4155\/revisions"}],"predecessor-version":[{"id":4157,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=\/wp\/v2\/posts\/4155\/revisions\/4157"}],"wp:attachment":[{"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elehobby.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}