久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

標題: Servo+Knob Arduino代碼 [打印本頁]

作者: EdwardGU123    時間: 2023-1-1 18:02
標題: Servo+Knob Arduino代碼
  1. /*
  2. Controlling a servo position using a potentiometer (variable resistor)

  3. modified on 8 Nov 2013
  4. */

  5. #include <Servo.h>

  6. Servo myservo;  // create servo object to control a servo

  7. int potpin = 0;  // analog pin used to connect the potentiometer
  8. int val;    // variable to read the value from the analog pin

  9. void setup() {
  10.   myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  11. }

  12. void loop() {
  13.   val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  14.   val = map(val, 0, 1023, 0, 180);     // scale it to use it with the servo (value between 0 and 180)
  15.   myservo.write(val);                  // sets the servo position according to the scaled value
  16.   delay(15);                           // waits for the servo to get there
  17. }


復制代碼







歡迎光臨 (http://m.zg4o1577.cn/bbs/) Powered by Discuz! X3.1
主站蜘蛛池模板: 亚洲 欧美 日韩在线 | 一级黄色夫妻生活 | 成人久久久 | 日本一区不卡 | 免费观看av | 免费黄色在线 | 亚洲另类春色偷拍在线观看 | 久久i | 国产日韩亚洲欧美 | 在线āv视频 | 国产精品乱码一区二区三区 | 99久久精品国产一区二区三区 | 亚州毛片 | 成人国产精品久久久 | 青青久久 | 欧美日韩精品中文字幕 | 亚洲伊人a | 成人午夜免费网站 | 久久蜜桃精品 | 精品日韩一区 | 手机av免费在线 | 99在线免费观看视频 | 欧美精品二区 | 91久久国产综合久久 | 一区二区在线免费观看视频 | 影音先锋亚洲资源 | 91国内精品久久 | 日本在线网址 | 久久久久亚洲精品中文字幕 | 日韩欧美大片在线观看 | 3级毛片| 午夜无码国产理论在线 | 夜夜骑首页 | 男女一区二区三区 | 成年人网站在线观看视频 | 天天想天天干 | 国产一区高清 | 怡红院怡春院一级毛片 | 97超碰人人草 | 中文字幕一二三区 | 国产在线精品一区 |