头像-85837

快雪时晴

  • 澳门特别行政区
  • 单片机 DSP EDA/PCB RF/无线 模拟技术
  • 医疗电子

个人成就

获得 0 次赞

帮助过0人

为什么我的UNO模拟端口在0输入时会产生一个正弦信号?

这个图前一部分我什么都没接,后面我给输入接了一个0v

为什么我的UNO模拟端口在0输入时会产生一个正弦信号?

const int sigin = 2; const int ledPin = 2; // the pin that the LED is attached to int sig_sensor; int sig_close; void setup() { Serial.begin(9600); //initialisation of the port pinMode(sigin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { sig_sensor = analogRead(sigin); Serial.write(sig_sensor); //sending of the number delay(50); //wait 0.1 second // read the most recent byte (which will be from 0 to 255): // check if data has been sent from the computer: if (Serial.available()) { sig_close = Serial.read(); //sigout = map(sig_close,-50,50,-512,512); // set the brightness of the LED: digitalWrite(ledPin, sig_close); //delay(5000); //digitalWrite(ledPin, 0); } }

为什么我的UNO模拟端口在0输入时会产生一个正弦信号?

代码在楼下,我定义模拟输入脚是A2,但是我什么输入都不接A2就有一个自动的正弦信号啊。。。

为什么我的UNO模拟端口在0输入时会产生一个正弦信号?

const int sigin = 2; const int ledPin = 2; // the pin that the LED is attached to int sig_sensor; int sig_close; void setup() { Serial.begin(9600); //initialisation of the port pinMode(sigin, INPUT); pinMode(ledPin, OUTPUT); } void loop() { sig_sensor = analogRead(sigin); Serial.write(sig_sensor); //sending of the number delay(50); //wait 0.1 second // read the most recent byte (which will be from 0 to 255): // check if data has been sent from the computer: if (Serial.available()) { sig_close = Serial.read(); //sigout = map(sig_close,-50,50,-512,512); // set the brightness of the LED: digitalWrite(ledPin, sig_close); //delay(5000); //digitalWrite(ledPin, 0); } }