Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
99 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
setInterval(() => { | ||
console.data({ | ||
temp: 20 + Math.random() / 10, | ||
humi: 80 + Math.random() / 100, | ||
}) | ||
}, 500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { pins, board } from "@dsboard/pico" | ||
import { | ||
startButton, | ||
startHidKeyboard, | ||
startLightBulb, | ||
} from "@devicescript/servers" | ||
import { | ||
HidKeyboardAction, | ||
HidKeyboardModifiers, | ||
HidKeyboardSelector, | ||
} from "@devicescript/core" | ||
|
||
// the keyboard button mounted on GP14 | ||
const button = startButton({ | ||
pin: pins.P14, | ||
}) | ||
// a status indicator led mounted on GP1 | ||
const led = startLightBulb({ | ||
pin: pins.P1, | ||
}) | ||
// the HID keyboard driver that will send keystrokes | ||
const keyboard = startHidKeyboard({}) | ||
|
||
// true: ctrl+c, false: ctrl+v | ||
let copy = true | ||
// use leftgui on mac or leftcontrol on windows | ||
let modifier = HidKeyboardModifiers.LeftGUI | ||
|
||
// copy and paste on button click | ||
button.down.subscribe(async () => { | ||
// when copy is true, send ctrl+c | ||
const selector = copy ? HidKeyboardSelector.C : HidKeyboardSelector.V | ||
// when copy is true, turn on the led to represent a "full clipboard" | ||
const brightness = copy ? 1 : 0 | ||
|
||
// a bit of logging | ||
console.log(copy ? "ctrl+c" : "ctrl+v") | ||
await keyboard.key(selector, modifier, HidKeyboardAction.Press) | ||
await led.brightness.write(brightness) | ||
// toggle for next round | ||
copy = !copy | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 20 | ||
sidebar_position: 2 | ||
--- | ||
|
||
# Command Line | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "Samples", | ||
"position": 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "RP2040", | ||
"position": 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Visual Studio Code Extension", | ||
"position": 19 | ||
"position": 1 | ||
} |