microcontrolador digitales2
/
i2cesclavo
JHKLJHKJLHKL
Diff: main.cpp
- Revision:
- 0:50b9be5874c2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Mar 19 16:31:38 2022 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "I2CSlave.h" + +using namespace std; + +Serial pc(USBTX, USBRX);//-----serial monitor connection +I2CSlave slave(PTC9,PTC8); //Configure I2C slave +DigitalOut LD(D2); //-----------LD Toggle on/off---------[D2 pin5] +char i2c; + + +int main() { + slave.address(0x05); + printf("STM STARTING/r/n"); + printf("STM Ready/r/n"); + while(1){ + i2c = slave.read(); + printf("%c",i2c); + + } +} \ No newline at end of file