Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor. 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. */ 功能:读取模拟引脚A0上的电压值,并将其转换...
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu). 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. https://www.arduino.cc/en/Tutorial/BuiltInExamples/ReadAnalogVolta...
/*Analog InputDemonstrates analog input by reading an analog sensor on analog pin 0 andturning on and off a light emittingdiode(LED) connected to digital pin 13.The amount of time the LED will be on and off depends on the value obtainedby analogRead().The circuit:- potentiometercenter pin ...
to pin 13 on the board, the LED is optional. Created by David Cuartielles modified 30 Aug 2011 By Tom Igoe This example code is in the public domain. http://www.arduino.cc/en/Tutorial/AnalogInput */ int sensorPin = A0; // select the input pin for the potentiometer int ledPin = 1...
A0, and the outside pins to +5V and ground. This example code is in the public domain.*/intsensorValue =0;voidsetup() { pinMode(A0, INPUT); Serial.begin(9600); }voidloop() {//read the input on analog pin 0:sensorValue =analogRead(A0);//print out the value you read:Serial.pri...
This example code is in the public domain. */ // These constants won't change. They're used to give names // to the pins used: const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const int analogOutPin = 9; // Analog output pin that the LED ...
Arduino 英文教学04《Analog Inputs》 是在优酷播出的教育高清视频,于2012-05-18 08:24:39上线。视频内容简介:Arduino 英文教学04《Analog Inputs》
This example code is in the public domain. 此代码示例位于公共域中。 http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage */ (3)设置函数 // the setup routine runs once when you press reset: 点击重置按钮后设置例程仅运行一次: void setup() { ...
This example code is in the public domain.*/intsensorValue =0;intoutputValue =0;voidsetup() { pinMode(A0, INPUT); pinMode(9, OUTPUT); Serial.begin(9600); }voidloop() {//read the analog in value:sensorValue =analogRead(A0);//map it to the range of the analog out:outputValue =...
// put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: } 1. 2. 3. 4. 5. 6. 7. 8. 9. 如果你使用过C/C++语言,你会发现Arduino的程序结构与传统的C/C++结构的不同之处就在于Arduino程序中没有main函数 ...