![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
c
main.cpp
- Committer:
- Saide
- Date:
- 2020-04-26
- Revision:
- 1:0b65d1f1d8f7
- Parent:
- 0:bdb6d686a9cf
File content as of revision 1:0b65d1f1d8f7:
#include "mbed.h" void allumerLed(int); void eteindreLed(int); char valeurLed[1]; I2C LED (p9,p10); const int addr = 0x7e; int main() { valeurLed[0]= 0xff; int i=1; char cmd[2]; cmd[0]=0x00; LED.write(addr,cmd,1); while(1) { allumerLed((i%8)+1); i++; wait(1); } } void allumerLed(int numLed) { switch(numLed) { case 1 : valeurLed[0]=0x01; break; case 2 : valeurLed[0]=0x02; break; case 3 : valeurLed[0]=0x04; break; case 4 : valeurLed[0]=0x08; break; case 5 : valeurLed[0]=0x10; break; case 6 : valeurLed[0]=0x20; break; case 7 : valeurLed[0]=0x40; break; case 8 : valeurLed[0]=0x80; break; default : valeurLed[0]=0x00; break; } valeurLed[0]=valeurLed[0]&0xff; LED.write(addr,valeurLed,1); } void eteindreLed(int numLed) { }