team app1
/
HelloWorld
test
Fork of HelloWorld by
main.cpp
- Committer:
- kkalsi
- Date:
- 2017-08-30
- Revision:
- 8:bb27936d2358
- Parent:
- 7:32229ffff57e
- Child:
- 9:f36f1506a840
File content as of revision 8:bb27936d2358:
#include "mbed.h" //hello Serial pc(USBTX, USBRX); // tx, rx I2C comI2C(p9,p10); // sda, scl // Communication I2C int main() { comI2C.start(); comI2C.write(0x1D); // A write to device comI2C.write(0x06); // Register to read from (acceleration in X) comI2C.start(); // Need to send start condition here comI2C.write(0x1D); // tell devide you want to read int c=comI2C.read(0); // Read the data with NACK comI2C.stop(); pc.printf("degree : %d", c); } /* communication SPI Serial pc(USBTX, USBRX); // tx, rx SPI acc(p11,p12,p13); DigitalOut cs(p14); int main() { while(1){ int nombre = 0; pc.printf("Entrez un nombre de 4 chiffres : "); pc.scanf("%d", &nombre); pc.printf("Votre numero entrez est le : %d", nombre); cs = 0; acc.write(nombre); cs = 1; wait(0.2); cs = 0; wait(1); } }*/ /* Serial pc(USBTX, USBRX); // tx, rx Serial mc(p13,p14); int main() { int nombre = 0; pc.printf("Entrez un nombre de 4 chiffres : "); pc.scanf("%d", &nombre); pc.printf("Votre numero entrez est le : %d", nombre); mc.printf(nombre); } */ /* DigitalOut myled(LED2); int main() { while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } } */