高清實測|360度旋轉的伺服馬達 arduino sg90 rotation servo

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024

ความคิดเห็น • 15

  • @user-sg7mi4vx4i
    @user-sg7mi4vx4i ปีที่แล้ว +1

    很棒❤

  • @goldbeefking7514
    @goldbeefking7514 หลายเดือนก่อน

    請問SG90有辦法連接連桿的形式嗎

    • @newtalent108
      @newtalent108  หลายเดือนก่อน

      應該用熱溶膠就可以

    • @goldbeefking7514
      @goldbeefking7514 หลายเดือนก่อน

      @@newtalent108 好 謝謝

  • @federica8443
    @federica8443 3 หลายเดือนก่อน

    可以添加遥控器什么的吗?

    • @newtalent108
      @newtalent108  3 หลายเดือนก่อน

      可以喔 遙控器是一種紅外線訊號

  • @user-xj1iz1bz5q
    @user-xj1iz1bz5q 8 หลายเดือนก่อน

    我想問 我要怎麼讓他配合rtc 讓他在時間內只旋轉一次 我想讓他當作盒子的開啟 我現在做完後她會在時間內一直旋轉 直到時間結束

    • @newtalent108
      @newtalent108  8 หลายเดือนก่อน

      寫在loop裡就是會一直重複,簡單做法是把旋轉寫在setup裡

    • @user-xj1iz1bz5q
      @user-xj1iz1bz5q 8 หลายเดือนก่อน

      @@newtalent108 感謝我蜂鳴器他時間到會一直叫沒辦法停現在變成馬達不會動了
      我想讓蜂鳴器和馬達時間到作動一次就好

    • @user-xj1iz1bz5q
      @user-xj1iz1bz5q 8 หลายเดือนก่อน

      @@newtalent108
      #include "Arduino.h"
      #include "Wire.h"
      #include "Adafruit_SSD1306.h"
      #include "RTClib.h"
      #include "Servo.h"
      #define OLED_RESET 4
      #define SERVO9G_PIN_SIG 3
      #define BUZZER_PIN 10
      #define OLED_I2C_ADDRESS 0x3C
      Adafruit_SSD1306 oLed094(OLED_RESET);
      RTC_DS3231 rtcDS;
      Servo servo9g;
      const int servo9gRestPosition = 20;
      const int servo9gTargetPosition = 90;
      bool medicineTaken = false;
      bool servoRotated = false;
      void setup() {
      Serial.begin(9600);
      while (!Serial);
      Serial.println("start");
      oLed094.begin(OLED_RESET);
      oLed094.clearDisplay();
      oLed094.display();
      if (!rtcDS.begin()) {
      Serial.println("Couldn't find RTC");
      while (1);
      }
      DateTime correctedTime(F(__DATE__), F(__TIME__));
      rtcDS.adjust(correctedTime);
      servo9g.attach(SERVO9G_PIN_SIG);
      servo9g.write(servo9gRestPosition);
      delay(100);
      servo9g.detach();
      }
      void loop() {
      DateTime now = rtcDS.now();
      // 如果是旋轉伺服馬達的時間,執行一次
      if (!servoRotated && now.hour() == 13 && now.minute() == 3) {
      Serial.println("Rotating servo...");
      rotateServo();
      servoRotated = true;
      }
      // 如果是提醒使用者的時間,執行一次
      if (!medicineTaken && now.hour() == 13 && now.minute() == 3) {
      remindUser();
      medicineTaken = true;
      }
      // 顯示當前時間
      displayCurrentTime(now);
      // 延遲 1 秒
      delay(1000);
      }
      void displayCurrentTime(DateTime currentTime) {
      oLed094.clearDisplay();
      oLed094.setTextSize(1);
      oLed094.setTextColor(WHITE);
      oLed094.setCursor(0, 10);
      oLed094.print("Current Time: ");
      oLed094.print(currentTime.hour() < 10 ? "0" : "");
      oLed094.print(currentTime.hour(), DEC);
      oLed094.print(":");
      oLed094.print(currentTime.minute() < 10 ? "0" : "");
      oLed094.print(currentTime.minute(), DEC);
      oLed094.print(":");
      oLed094.print(currentTime.second() < 10 ? "0" : "");
      oLed094.println(currentTime.second(), DEC);
      oLed094.display();
      }
      void remindUser() {
      oLed094.clearDisplay();
      oLed094.setTextSize(1);
      oLed094.setTextColor(WHITE);
      oLed094.setCursor(0, 10);
      oLed094.println("Time to take medicine!");
      oLed094.display();
      // 啟動蜂鳴器,持續 10 秒
      tone(BUZZER_PIN, 1000, 10000);
      delay(10000);
      noTone(BUZZER_PIN);
      }
      void rotateServo() {
      servo9g.attach(SERVO9G_PIN_SIG);
      servo9g.write(servo9gTargetPosition);
      delay(1000);
      servo9g.detach();
      }
      這是我現在的程式碼 我用sg90馬達和低電平觸發蜂鳴器

  • @DaveYang-rt5qb
    @DaveYang-rt5qb 8 หลายเดือนก่อน

    可以工業用嗎? 一天使用15小時

    • @newtalent108
      @newtalent108  8 หลายเดือนก่อน

      不建議,這款扭力太小,會有過熱問題
      可以去買工規或金屬製的,比較能長時間使用

  • @tomcat23l
    @tomcat23l 11 หลายเดือนก่อน

    我要怎麼選購及下載軟體

    • @newtalent108
      @newtalent108  11 หลายเดือนก่อน

      零件可以去蝦皮用關鍵字找喔,通常SG90一顆大概四五十塊,軟體下載可以到Arduino官網www.arduino.cc/en/software/