Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: qsb_scan.cpp
- Revision:
- 0:2a3d940c3621
diff -r 000000000000 -r 2a3d940c3621 qsb_scan.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qsb_scan.cpp Thu Feb 25 00:44:58 2016 +0000
@@ -0,0 +1,34 @@
+/*
+Sends a scan code to the PC over usb HID
+*/
+#include "mbed.h"
+#include "USBHID.h"
+#include "VKCodes.h"
+
+DigitalOut led (P0_7);
+USBHID hid(8, 8,0x1234,0x3241); //Create a HID conection with and 8 byte input and output report, PID0x1234 VID 3241
+HID_REPORT send_report;
+HID_REPORT recv_report;
+
+
+int main(void){
+ send_report.length = 8;
+ while(1){
+ if(hid.readNB(&recv_report)){
+ if(recv_report.data[1]==0xaa){ //reciev 0xaa puts the device into keyboard mode
+ for (int i = 0; i<10;i++){
+ send_report.data[0] = 0;
+ send_report.data[1] = 99; //send code for mod key comibination
+ send_report.data[2] = 55; //send code for specific key
+ send_report.data[3] = 0;
+ send_report.data[4] = 0;
+ send_report.data[5] = 0;
+ send_report.data[6] = 0;
+ send_report.data[7] = 0;
+ wait_ms(58);
+ hid.send(&send_report);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file