Open
Description
Describe the bug
Users following the tutorial video are instructed to create non-compiling code.
This will block users within the target audience.
To Reproduce
- In browser, load https://github.com/microsoft/devicescript
- Scroll down to embedded video.
- Follow along in VSCode with video until ~1m56s, where video instructs to run the program under the debugger.
Expected behavior
Example / tutorial code is correct -- it must compile and execute.
The importance of having correct sample code cannot be overstated.
Additional context
As this is a video, it is not possible to provide a simple PR.
Problematic code:
import * as ds from "@devicescript/core"
const lightbulb = new ds.LightBulb();
setInterval(async() => {
const brightness = await lightbulb.brightness.read();
await lightbulb.brightness.write(brightness > 0 ? 0 : 1);
}, 1000)
Likely correct code:
import * as ds from "@devicescript/core"
const lightbulb = new ds.LightBulb();
setInterval(async() => {
// intensity is defined as a number between 0 and 0xFFFF
const intensity = await lightbulb.intensity.read();
console.log("intensity: ", intensity);
if (intensity > 0) {
await lightbulb.off();
} else {
await lightbulb.on();
}
}, 1000)