ok

Dependencies:   mbed

Fork of _test_suivi_mur by christophe vermaelen

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "fct.h"
00003 DigitalOut cs(p13);
00004 DigitalIn bp(p14);
00005 int main()
00006 {
00007     char A=0x80;
00008     char B=0x00;
00009     monI2C.write(ADR_PCF,&A,1);
00010     vitG.period(PERIOD);
00011     vitD.period(PERIOD);
00012     vitG.pulsewidth(PERIOD);
00013     vitD.pulsewidth(PERIOD);
00014     cs = 1;                //initialisation de CS à ‘1’
00015     spi.format(16,0);
00016     spi.frequency(1000000);
00017     bp.mode(PullUp);
00018     while(1) {
00019         leds.write(bp.read()+1);
00020         //cs=0;
00021         monI2C.write(ADR_PCF,&B,1);
00022         unsigned int valeur = spi.write(0x00);
00023         valeur = (valeur>>1)&0x0FFF;
00024         printf("valeur lue = %d\n\r", valeur);
00025         //cs=1;
00026         monI2C.write(ADR_PCF,&A,1);
00027         wait(0.05);
00028     }
00029 }