Arduino101学习笔记(五)—— 模拟IO

1、配置IO管脚

//*********************************************************************************************
//函数名称:void analogReference (uint8_t type);
//输入参数:type: DEFAULT : 默认5V
//                               INTERNAL: 低功耗模式
//                               EXTERNAL: 扩展模式. 通过AREF引脚获取参考电压
//函数返回:无
//函数功能:模拟IO配置
//*********************************************************************************************
void analogReference (uint8_t type);

2、读取模拟IO管脚
//*********************************************************************************************
//函数名称:int analogRead (uint8_t pin);
//输入参数:pin: 0 ~ 5
//函数返回:0~1023
//函数功能:模拟IO读取
//*********************************************************************************************
int analogRead (uint8_t pin);

3、写模拟IO管脚

//*********************************************************************************************
//函数名称:void analogWrite (uint8_t pin, int value) ;
//输入参数:pin: 0 ~ 5    value  0~ 256
//函数返回:无
//函数功能:模拟IO写
//*********************************************************************************************
void analogWrite (uint8_t pin, int value) ;

    使用数字PWM(频率1KHz一下)来模拟DAC输出

posted @ 2016-11-12 12:16  Blue Mountain  阅读(1165)  评论(0编辑  收藏  举报