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.
OUT.txt
- Committer:
- kurobikari
- Date:
- 2019-10-16
- Revision:
- 29:b3f2dfd166ac
- Parent:
- 16:a01acc32466d
File content as of revision 29:b3f2dfd166ac:
#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[]= { {100, 0, 0}, {100, 1, 0}, {100, 2, 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"); } }