Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
MCP4018.cpp
00001 //********************** 00002 // MCP4018.cpp for mbed 00003 // 00004 // MCP4018 mcp4018(P0_5,P0_4); 00005 // or 00006 // I2C i2c(P0_5,P0_4); 00007 // MCP4018 mcp4018(i2c); 00008 // 00009 // (C)Copyright 2014 All rights reserved by Y.Onodera 00010 // http://einstlab.web.fc2.com 00011 //********************** 00012 00013 #include "mbed.h" 00014 #include "MCP4018.h" 00015 00016 MCP4018::MCP4018 (PinName sda, PinName scl) : _i2c(sda, scl) { 00017 } 00018 MCP4018::MCP4018 (I2C& p_i2c) : _i2c(p_i2c) { 00019 } 00020 00021 00022 void MCP4018::put(unsigned char a) 00023 { 00024 00025 buf[0]=0x7F & a; 00026 _i2c.write(MCP4018_ADDR, buf, 1); 00027 00028 } 00029
Generated on Sat Jul 16 2022 20:52:55 by
1.7.2