test clavier

Dependencies:   USBDevice mbed

Fork of USBJoystick_HelloWorld by Wim Huiskamp

main.cpp

Committer:
bouaziz
Date:
2017-05-10
Revision:
1:61f0689edc0a
Parent:
0:5037d4be5b6d

File content as of revision 1:61f0689edc0a:

#include "mbed.h"
#include "USBKeyboard.h"

USBKeyboard keyboard;

// Variables for Heartbeat and Status monitoring
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut heartbeatLED(LED4);

DigitalIn  mic (p14);

Serial pc(USBTX, USBRX); // tx, rx


char state;
int main(){
 //   pc.printf("%u\n\r",);
    while (1) {
        if((state==0)&(mic==1)){
            state=1;
   //         pc.printf("oui\n\r");
             keyboard.keyCode2(0x00,0x10,0);     //sends touche CTRL  through the keyboard
             myled1=1;
        }else{  
             if(mic==0){
                    state=0;
                    keyboard.key_release();// release
                    myled1=0;
             }
        }
        wait(0.20);
    }
    
}