4743浏览
查看: 4743|回复: 2

Bluno M3 PWM

[复制链接]
本帖最后由 Ricky 于 2015-1-4 16:03 编辑

目录:
    概述
    PWM 参考函数
    参考例程

1.概述
PWM是该模块的基础功能,Bluno M3板子上标有波浪号的端口都是PWM口(0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12 , 14, 27, 28, 35, 36, 37, 38),其中5、9、14是模拟,其他都是硬件定时器产生。

2.PWM 参考函数
analogWrite()

3.参考例程

  1. int ledPin = 0;    // LED connected to digital pin 0
  2.         
  3. void setup()
  4. {         
  5. //nothing happens in setup        
  6. }        
  7. void loop() {         
  8.         // fade in from min to max in increments of 5 points:         
  9.         for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5)
  10.         {            
  11.                     
  12.                 analogWrite(ledPin, fadeValue);         // sets the value (range from 0 to 255):            
  13.                     
  14.                 delay(30);          // wait for 30 milliseconds to see the dimming effect        
  15.         }        
  16.         // fade out from max to min in increments of 5 points:         
  17.         for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5)
  18.         {            
  19.                 analogWrite(ledPin, fadeValue);           // sets the value (range from 0 to 255):        
  20.                
  21.                 delay(30);                              // wait for 30 milliseconds to see the dimming effect         
  22.         }        
  23. }
复制代码


hnyzcj  版主

发表于 2015-1-4 15:32:27

顶一个呀
回复

使用道具 举报

Grey  中级技匠

发表于 2015-1-4 21:13:24

建议楼主做一个目录,把所有关于M3的资料和相关教程都放在里面,方面后人查阅
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail