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.
Diff: OUT.txt
- Revision:
- 16:a01acc32466d
- Child:
- 24:4555d379fa1e
- Child:
- 29:b3f2dfd166ac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OUT.txt Tue May 07 08:59:39 2019 +0000 @@ -0,0 +1,45 @@ +#include "mbed.h" +#include "YKNCT_I2C.h" + +#define OUT_MAX 12 +#define HIGH 1 +#define LOW 0 + +Serial pc(USBTX, USBRX); // tx, rx +Y_I2C i2c(PB_9, PB_8); + +OUT_I2C_Data_TypeDef OUT_I2C_Data[]= { + {15, 0, 0}, + {15, 1, 0}, + {15, 2, 0}, + {15, 3, 0}, + {15, 4, 0}, + {15, 5, 0}, + {15, 6, 0}, + {15, 7, 0}, + {14, 0, 0}, + {14, 1, 0}, + {14, 2, 0}, + {14, 3, 0}, +}; + +int main() +{ + while(1) { + for(int i=0; i<OUT_MAX; i++) { + i2c.Out_Set(OUT_I2C_Data, i, HIGH); + i2c.Out(OUT_I2C_Data, OUT_MAX); + wait(0.1); + pc.printf("%d ",(OUT_I2C_Data+i) -> out_data); + } + pc.printf("\n\r"); + + for(int i=0; i<OUT_MAX; i++) { + i2c.Out_Set(OUT_I2C_Data, i, LOW); + i2c.Out(OUT_I2C_Data, OUT_MAX); + wait(0.1); + pc.printf("%d ",(OUT_I2C_Data+i) -> out_data); + } + pc.printf("\n\r"); + } +} \ No newline at end of file