Pancake Library for mbed
Diff: pancake.cpp
- Revision:
- 0:ee3420f81e2b
- Child:
- 1:2eaa0fea479c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pancake.cpp Sun Nov 22 14:50:54 2015 +0000 @@ -0,0 +1,23 @@ +#include "pancake.hpp" + +Pancake::Pancake(PinName tx,PinName rx) : _pc(tx,rx){ + _pc.baud(115200); + } +void Pancake::sound1(uint8_t cn,uint8_t on ,uint8_t sn){ + uint8_t data[4]={0x0A,cn,on,sn}; + _sendCommand(data,4); + } + + + +void Pancake::_sendCommand(uint8_t data[],uint8_t length) +{ + uint8_t i = 0; + _pc.putc(0x80); + _pc.putc(length + 2); + + while(i < length ){ + _pc.putc(data[i]); + i++; + } + } \ No newline at end of file