Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7de75b5

Browse files
Merge pull request #1014 from arduino/karlsoderby/giga-usb-fix
[GIGA] USB Keyboard Example fix
2 parents c1f4e8c + 16a4082 commit 7de75b5

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

‎content/hardware/10.mega/boards/giga-r1-wifi/tutorials/giga-usb/giga-usb.md‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,34 +432,43 @@ After logging data, remove the USB stick from your board, and insert it in your
432432

433433
It is possible to connect generic USB keyboards to the GIGA R1's USB-A connector without any additional circuitry.
434434

435-
The library used for this can be downloaded through Github.
435+
The library used for this can be downloaded through Github.
436436
- [USBHostGiga](https://github.com/arduino-libraries/USBHostGiga)
437437

438+
Please note that this library is in **Alpha** development stage. This means support is experimental and examples may not function as expected. Future versions of this library may break the example provided below.
439+
438440
***The USBHostGiga library is not available in the Arduino IDE and needs to be installed manually. You can do so my navigating to `Sketch` > `Include Library` > `Add .ZIP Library`.***
439441

440442
```arduino
441-
#include "HIDHost.h"
443+
#include "USBHostGiga.h"
442444
443-
Keyboard keyb; //create object
445+
//REDIRECT_STDOUT_TO(Serial)
446+
Keyboard keyb;
447+
HostSerial ser;
444448
445449
void setup() {
446450
// put your setup code here, to run once:
447451
Serial.begin(115200);
448452
while (!Serial);
449-
pinMode(PA_15, OUTPUT); //enable the USB-A port //enable the USB-A connector
450-
keyb.begin(); //init the library
453+
pinMode(PA_15, OUTPUT);
454+
keyb.begin();
455+
ser.begin();
451456
}
452457
453458
454459
void loop() {
455460
if (keyb.available()) {
456-
Serial.println(keyb.read()); //print any incoming character
461+
auto _key = keyb.read();
462+
Serial.println(keyb.getAscii(_key));
463+
}
464+
while (ser.available()) {
465+
auto _char = ser.read();
466+
Serial.write(_char);
457467
}
468+
//delay(1);
458469
}
459470
```
460471

461-
***Please note that he `PA15` pin must be configured as an `OUTPUT`.***
462-
463472
## USB HID
464473

465474
It is possible to turn your GIGA R1 board into a Human Interface Device **(HID)**, aka mouse & keyboard, using the [USBHID](https://github.com/arduino/ArduinoCore-mbed/tree/master/libraries/USBHID) library which is included in the GIGA core.

‎scripts/resources/spell-check-ignore-list.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ synopsys
1111
trun
1212
complies
1313
ro
14-
som
14+
som
15+
ser

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /