小皮小皮 发表于 2012-5-14 20:56:42

希望得到指点

我是一个初学者,作为一个项目组成员,我需要在一个周之内用arduino实现将数据发送至USB口。但是不知道从哪里入手,希望得到大家的指点。现在我打算先看懂它的引脚及其功能。谢谢{:soso_e100:}

弘毅 发表于 2012-5-14 21:33:27

直接把这个代码下载进入1.0 IDE编译下载,打开串口监视器,就能看到传回USB的A0口读数了。

/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor

This example code is in the public domain.
*/

void setup() {
Serial.begin(9600);
}

void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
}

arduino驱动USB相当简单。。。说白了就是用Serial库

Randy 发表于 2012-5-14 21:58:17

弘毅 发表于 2012-5-14 21:33 static/image/common/back.gif
直接把这个代码下载进入1.0 IDE编译下载,打开串口监视器,就能看到传回USB的AO口读数了。

/*


弘毅大哥帮的很快吧。呵呵

小皮小皮 发表于 2012-5-15 19:03:10

{:soso__11902779381113851803_2:}谢谢你!:)我想我应要先把这个arduino自带的examples看懂。因为上面您提供的程序我是初次接触。尽管是c语言,我还需要熟悉一下。若是遇到什么问题,还会来请教的,还希望不哟啊介意呢{:soso__11800006593393262895_4:}

珜羽 发表于 2012-5-16 23:33:15

弘毅 发表于 2012-5-14 21:33 static/image/common/back.gif
直接把这个代码下载进入1.0 IDE编译下载,打开串口监视器,就能看到传回USB的A0口读数了。

/*


数据发送至USB口....你这个是串口吧??LZ没有把意思说清楚额。
页: [1]
查看完整版本: 希望得到指点