Ai
1 Star 0 Fork 0

DFRobot/DFRobot_utility

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
io.cpp 901 Bytes
一键复制 编辑 原始数据 按行查看 历史
lisper 提交于 2014-11-10 11:08 +08:00 . add io library
/**************************************************************************/
/*!
@file io.cpp
@author lisper (lisper.li@dfrobot.com)
@license LGPLv3 (see license.txt)
provide some useful function make it easy to control io
Copyright (C) 2014 DFRobot
*/
#include <Arduino.h>
#include "io.h"
digitalOut::digitalOut (uint8_t thePin) {
pin = thePin;
pinMode (thePin, OUTPUT);
}
void digitalOut:: write (uint8_t value) {
digitalWrite (pin, value);
}
digitalIn::digitalIn (uint8_t thePin) {
pin = thePin;
pinMode (pin, INPUT);
}
uint8_t digitalIn::read () {
return digitalRead (pin);
}
analogOut::analogOut (uint8_t thePin) {
pin = thePin;
pinMode (pin, OUTPUT);
}
void analogOut::write (uint8_t value) {
analogWrite (pin, value);
}
analogIn::analogIn (uint8_t thePin) {
pin = thePin;
pinMode (pin, INPUT);
}
uint16_t analogIn::read () {
return analogRead (pin);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/dfrobot/DFRobot_utility.git
git@gitee.com:dfrobot/DFRobot_utility.git
dfrobot
DFRobot_utility
DFRobot_utility
master

搜索帮助