Used as part of the OU_Davis_Old_Robot library
Diff: MCP3008.h
- Revision:
- 0:2cb766caa4c7
diff -r 000000000000 -r 2cb766caa4c7 MCP3008.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MCP3008.h Wed Nov 01 15:56:02 2017 +0000 @@ -0,0 +1,23 @@ +// +// +// +#ifndef _MCP3008_H +#define _MCP3008_H + +#include <mbed.h> + +class MCP3008 { + protected: + SPI _spi; + DigitalOut _cs; + float _vref; + int _data1; + int _data2; + + public: + MCP3008(PinName mosi=p11, PinName miso=p12, PinName clk=p13, PinName cs=p14); + int read(int ch); + float vref(float v){return _vref=v;} +}; + +#endif //_MCP3008_H \ No newline at end of file