zoukankan      html  css  js  c++  java
  • 用Tinkercad学arduino之 读取电位器模拟输入

    /*
      AnalogReadSerial
      Reads an analog input (potentiometer) on pin 0,
      prints the result to the serial monitor.
    
      OPEN THE SERIAL MONITOR TO VIEW THE OUTPUT FROM
      THE POTENTIOMETER >>
    
      Attach the center pin of a potentiometer to pin
      A0, and the outside pins to +5V and ground.
    
      This example code is in the public domain.
    */
    
    int sensorValue = 0;
    
    void setup()
    {
      pinMode(A0, INPUT);
      Serial.begin(9600);
    
    }
    
    void loop()
    {
      // read the input on analog pin 0:
      sensorValue = analogRead(A0);
      // print out the value you read:
      Serial.println(sensorValue);
      delay(10); // Delay a little bit to improve simulation performance
    }
  • 相关阅读:
    Mysql其他
    Linux大全
    Django-你想知道的都在这里
    k8s
    极速安装k8s 快速融入学习
    flask orm
    Elasticsearch
    1爬虫
    MY git 操作
    docker 骚操作
  • 原文地址:https://www.cnblogs.com/meetrice/p/14077869.html
Copyright © 2011-2022 走看看