HelloWorld program for PCA9547: an I2C bus multiplexer control library. PCA9547 is an I2C multiplexer which enables to select 1:8 multiplexed I2C bus. The multiplexer is useful for deviding I2C bus to avoiding slave address conflict and separating capacitive loads. For more information about PCA9547: http://www.nxp.com/documents/data_sheet/PCA9547.pdf
Dependencies: LM75B PCA9547 mbed
main.cpp
00001 /** 00002 * PCA9547 library "Hello world" sample 00003 * 00004 * @author Tedd OKANO 00005 * @version 0.2 00006 * @date Feb-2015 00007 * 00008 * PCA9547: an I2C bus multiplexer control library 00009 * 00010 * PCA9547 is an I2C multiplexer which enables to select 1:8 multiplexed I2C bus. 00011 * The multiplexer is useful for deviding I2C bus to avoiding slave address conflict and separating capacitive loads. 00012 * 00013 * For more information about PCA9547: 00014 * http://www.nxp.com/documents/data_sheet/PCA9547.pdf 00015 * 00016 */ 00017 00018 #include "mbed.h" 00019 #include "LM75B.h" 00020 #include "PCA9547.h" 00021 00022 PCA9547 mux( p28, p27, 0xE0 ); 00023 00024 int main() 00025 { 00026 mux.select( 0 ); 00027 00028 LM75B tmp0( p28, p27 ); // making instance after a branch of I2C bus (which is connecting the LM75B) enabled 00029 00030 while( 1 ) { 00031 printf( "%.3f\r\n", tmp0.read() ); 00032 wait( 1.0 ); 00033 } 00034 }
Generated on Fri Jul 15 2022 01:40:31 by 1.7.2