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.
main.cpp
00001 00002 #include "mbed.h" 00003 #include "MCP3221.h" 00004 00005 DigitalOut myled(LED1); 00006 00007 Serial pc(USBTX, USBRX); // tx, rx 00008 AnalogIn ain(p20); 00009 MCP3221 adc(p9, p10, 5.0); //sda, scl, supplyVoltage 00010 00011 int main() { 00012 00013 wait(1); 00014 while (1) { 00015 00016 pc.printf("ain: %f :: ", ain.read()*3.3); 00017 pc.printf("adc: %f \r\n", adc.read()); 00018 00019 00020 myled=!myled; 00021 00022 00023 wait(1); 00024 } 00025 }
Generated on Wed Jul 13 2022 08:32:31 by
1.7.2
MCP3221 Digital I2C 12bit ADC. 0v - 5v @ 1mV Library.