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.
Fork of USBHID_HelloWorld by
Revision 8:51572f1cec33, committed 2015-02-16
- Comitter:
- yglim
- Date:
- Mon Feb 16 04:54:21 2015 +0000
- Parent:
- 7:53a2d7e81b22
- Commit message:
- .
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Mar 01 13:22:56 2013 +0000
+++ b/main.cpp Mon Feb 16 04:54:21 2015 +0000
@@ -1,29 +1,30 @@
#include "mbed.h"
#include "USBHID.h"
-
+
//We declare a USBHID device. By default input and output reports are 64 bytes long.
USBHID hid(8, 8);
-
+
Serial pc(USBTX, USBRX);
-
+
//This report will contain data to be sent
HID_REPORT send_report;
HID_REPORT recv_report;
-
+
DigitalOut l1(LED1);
-
-int main(void) {
+
+int main(void)
+{
send_report.length = 8;
-
+
while (1) {
-
+
//Fill the report
for (int i = 0; i < send_report.length; i++)
send_report.data[i] = rand() & 0xff;
-
+
//Send the report
hid.send(&send_report);
-
+
//try to read a msg
if(hid.readNB(&recv_report)) {
l1 = !l1;
