0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

XIAO ESP32C3でサーボモータを動かす

Posted at

XIAO ESP32C3でサーボモータを動かす方法を解説します。

この記事は Tuton Advent Calender 2025 の12日目の記事です。

前提

プログラムはPlatformIOというVSCodeの拡張機能を使ってArduino言語で書きます。

PlatformIOはこちら。

方法

以下のライブラリを使用します。PlatformIOのLibraryから追加してください。

このようにサーボを動かすことができます。

main.cpp
#include <Arduino.h>
#include <ESP32_C3_ISR_Servo.h>

#define SERVO_PIN 4 // Servoのピン
Servo myservo;

void setup(){
}

void loop(){
    myservo.write(SERVO_PIN,0);
    delay(1000);
    myservo.write(SERVO_PIN,90);
    delay(1000);
}
    

その他の機能や詳しい仕様はこちらのGitHubからご覧ください。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?