完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
|
|
相关推荐
7个回答
|
|
|
哪个地方产生正弦信号?把图和程序发上来看看。
|
|
|
|
|
|
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); } }
|
|
|
|
|
|
代码在楼下,我定义模拟输入脚是A2,但是我什么输入都不接A2就有一个自动的正弦信号啊。。。
|
|
|
|
|
|
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); } }
|
|
|
|
|
|
还有个截图也放在楼下了
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
1064 浏览 1 评论
1885 浏览 0 评论
1863 浏览 1 评论
3286 浏览 5 评论
3613 浏览 9 评论
1064浏览 1评论
1887浏览 1评论
如何知道嵌入式电子控制单元 (ECU) 中的RAM使用情况?
1391浏览 1评论
1885浏览 0评论
1205浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-11 13:42 , Processed in 0.812499 second(s), Total 58, Slave 48 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2826