Carlos GS
/
blip_tecladoUSB
La MiniBlip se conectará como un teclado, y enviará un mensaje
main.cpp@2:ed92c558e40c, 2016-01-18 (annotated)
- Committer:
- carlosgs
- Date:
- Mon Jan 18 15:28:41 2016 +0000
- Revision:
- 2:ed92c558e40c
- Parent:
- 1:8936f9e1d2b1
Eliminado salto de linea al final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
carlosgs | 0:156e1c4f7361 | 1 | // basado en el codigo de Paclema: |
carlosgs | 0:156e1c4f7361 | 2 | // https://github.com/hack-miniblip/hack-miniblip.github.io/blob/master/ejemplos/miniblip_USBkeyboard/main.cpp |
carlosgs | 0:156e1c4f7361 | 3 | |
carlosgs | 0:156e1c4f7361 | 4 | #include "mbed.h" |
carlosgs | 0:156e1c4f7361 | 5 | #include "USBKeyboard.h" |
carlosgs | 0:156e1c4f7361 | 6 | |
carlosgs | 1:8936f9e1d2b1 | 7 | DigitalIn pushbutton(P0_23); |
carlosgs | 0:156e1c4f7361 | 8 | |
carlosgs | 0:156e1c4f7361 | 9 | USBKeyboard keyboard; |
carlosgs | 0:156e1c4f7361 | 10 | |
carlosgs | 0:156e1c4f7361 | 11 | int main() |
carlosgs | 0:156e1c4f7361 | 12 | { |
carlosgs | 0:156e1c4f7361 | 13 | PwmOut speaker(P0_8); |
carlosgs | 0:156e1c4f7361 | 14 | speaker=0.0; |
carlosgs | 1:8936f9e1d2b1 | 15 | |
carlosgs | 1:8936f9e1d2b1 | 16 | while(1) { |
carlosgs | 1:8936f9e1d2b1 | 17 | if (pushbutton) { |
carlosgs | 2:ed92c558e40c | 18 | keyboard.printf("Texto enviado desde la MiniBlip como teclado virtual"); |
carlosgs | 1:8936f9e1d2b1 | 19 | wait(1); // Waits 1 second before printing again |
carlosgs | 1:8936f9e1d2b1 | 20 | } |
carlosgs | 1:8936f9e1d2b1 | 21 | } |
carlosgs | 0:156e1c4f7361 | 22 | |
carlosgs | 0:156e1c4f7361 | 23 | } |