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:
- namcheol
- Date:
- 2020-04-27
- Revision:
- 2:b7fe18d989bc
- Parent:
- 1:89d23c8072af
File content as of revision 2:b7fe18d989bc:
#include "mbed.h" I2C i2c(I2C_SDA, I2C_SCL); //i2c = (I2C_SDA, I2C_SCL) DigitalIn sw(D0, PullDown); //sw = D0(PullDown) const int addr = 0xa0; //slave addr (even no.) int main() { while(true) { if(sw == 1) { //if switch is on(pressed) i2c.start(); //start condition i2c.write(addr | 0x00); //write (addr | WRTIE) i2c.write('1'); //write '1' i2c.stop(); //stop condition thread_sleep_for(200); } } }