我正在做一些基本的arduino项目,我已经按照此处列出的项目进行了操作:http://www.arduino.cc/en/Tutorial/SPIDigitalPot。
该项目主要向您展示如何设置数字电位器AD5206上各种通道的值。
使用该示例作为起点,有没有办法读取每个AD5206通道中设置的当前值?
答案 0 :(得分:1)
您无法直接从AD5206读取数据,但如果您真的想要,可以将AD5206输出引脚上的线连接到arduinos模拟引脚并以此方式读取。
我的头顶看起来像这样:
int potValue = ( analogRead(analogPin) / 1023 ) * 255; // divide analog pin value by 1023 to find fractional value then multiplied by 255 for pots value
可能不是100%准确但它应该在+/- 1
之内