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
- Committer:
- alexD
- Date:
- 2016-03-09
- Revision:
- 0:f9424a117b32
File content as of revision 0:f9424a117b32:
#include "mbed.h"
// init i2c
I2C i2c(p28, p27);
// bluetooth
Serial blue(p9, p10);
// pc console
Serial pc(USBTX, USBRX);
// slave address
const int addr = 0x20;
int main()
{
char cmd[10];
blue.baud(9600);
pc.baud(9600);
//i2c.frequency(50000);
cmd[0] = 100;
while (1) {
if (blue.readable()) {
cmd[0] = blue.getc();
pc.printf("%d", cmd[0]);
i2c.write(addr, cmd, 1);
}
}
}