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.
Fork of PCAL9555_Hello by
main.cpp
00001 #include "mbed.h" 00002 #include "PCAL9555.h" 00003 00004 PCAL9555 gpio_exp( PB_9, PB_8, 0x40 ); // SDA, SCL, Slave_address(option) 00005 GpioDigitalOut Bat3EN( gpio_exp, X0_2 ); 00006 GpioDigitalOut Bat2EN( gpio_exp, X0_1 ); 00007 GpioDigitalOut Bat1EN( gpio_exp, X0_0 ); 00008 00009 Serial pi(PA_11, PA_12); 00010 DigitalOut EN33(PA_8); 00011 DigitalOut EN_PI_PWR(PA_9); 00012 DigitalOut EN_SERVO_PWR(PB_5); 00013 DigitalOut EN_LIGHTS_PWR(PA_10); 00014 DigitalOut BAT_PWR_EN(PB_10); 00015 AnalogIn BatS1(PA_0); 00016 AnalogIn BatS2(PA_3); 00017 00018 int main() { 00019 int i = 1; 00020 float BatS1V; 00021 float BatS2V; 00022 pi.printf("Hello World !\n"); 00023 Bat3EN = 1; 00024 Bat2EN = 1; 00025 Bat1EN = 1; 00026 EN33 = 1; 00027 00028 EN_SERVO_PWR = 1; 00029 //EN_LIGHTS_PWR = 1; 00030 //EN_PI_PWR = 1; 00031 BAT_PWR_EN = 1; 00032 while( 1 ) { 00033 wait(3); 00034 //BAT_PWR_EN = !BAT_PWR_EN; 00035 pi.printf("This program runs since %d seconds.\n", i++); 00036 BatS1V = BatS1*(3.30/0.25); 00037 BatS2V = BatS2*(3.30/0.25); 00038 pi.printf("Battery 1 Voltage = %d Battery 2 Voltage = %d", static_cast<int>(BatS1V),static_cast<int>(BatS2V)); 00039 00040 } 00041 } 00042
Generated on Tue Jul 12 2022 19:29:16 by
1.7.2
