[AVR单片机] 关于avr的某段pwm的c语言,紧急求助

[复制链接]
2642|4
 楼主| lzwkiven 发表于 2011-5-1 12:18 | 显示全部楼层 |阅读模式
本帖最后由 lzwkiven 于 2011-5-1 12:28 编辑

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 255);  
  // change the analog out value:
  analogWrite(ana**utPin, outputValue);
delay(10);
}
我的c语言不过关,请问一下map(sensorValue, 0, 1023, 0, 255)是什么意思
wookongbun 发表于 2011-5-2 21:03 | 显示全部楼层
哈哈,这是arduino的代码;P
sensorValue的范围是0~1023,map()之后映射到0~255。想当与一个比例尺吧。
 楼主| lzwkiven 发表于 2011-5-11 22:06 | 显示全部楼层
O~谢谢
ming117284 发表于 2011-5-13 13:34 | 显示全部楼层
zhao9183 发表于 2011-5-23 21:57 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

0

主题

5

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部