analogRead()函数 @arduino

三轴加速度计与ard板连接好后,最重要的一个通讯函数就是analogRead(),这个函数的意思如下:

  Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit. The input range and resolution can be changed using analogReference().

  从指定的模拟插孔读取数据.ard板包含6个通道(Mini和Nano板包含8个,Mega板包含16个),10比特模拟到数字的转换。这意味着它将输入的0到5伏的电压采样转换为0到1023之间整数。这产生了分辨率的的说法,5伏/1024单位,或者4.9mV/单位.输入的范围和分辨率可以用analogReference()改变。

  It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.

该函数100微秒(0.0001秒)读一次数,因此最大的读取速度是每秒10000次。

posted on 2013-09-21 22:01  易猜  阅读(4783)  评论(0编辑  收藏  举报

导航