mbed-os/libraries/tests/mbed/digitalin_digitalout/main.cpp

47 lines
922 B
C++

#include "test_env.h"
#if defined(TARGET_LPC1114)
DigitalOut out(dp1);
DigitalIn in(dp2);
#elif defined(TARGET_LPC1549)
// TARGET_FF_ARDUINO cannot be used, because D0 is used as USBRX (USB serial
// port pin), D1 is used as USBTX
DigitalOut out(D7);
DigitalIn in(D2);
#elif defined(TARGET_NUCLEO_F103RB) || defined(TARGET_NUCLEO_F401RE) || defined(TARGET_NUCLEO_F411RE)
DigitalOut out(PC_6);
DigitalIn in(PB_8);
#elif defined(TARGET_DISCO_F407VG)
DigitalOut out(PC_12);
DigitalIn in(PD_0);
#elif defined(TARGET_FF_ARDUINO)
DigitalOut out(D7);
DigitalIn in(D0);
#else
DigitalOut out(p5);
DigitalIn in(p25);
#endif
int main() {
out = 0;
wait(0.1);
if (in != 0) {
printf("ERROR: in != 0\n");
notify_completion(false);
}
out = 1;
wait(0.1);
if (in != 1) {
printf("ERROR: in != 1\n");
notify_completion(false);
}
notify_completion(true);
}