Created
April 1, 2025 21:56
-
-
Save TheCuttlefish/9dc02ce394a568713d2487588b3f369c to your computer and use it in GitHub Desktop.
Show light sensor values 0-255 (makey makey + BBC:micro)
This file contains hidden or 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
basic.forever(function () { | |
let light = input.lightLevel() | |
let fillAmount = Math.map(light, 0, 255, 0, 25) | |
fillAmount = Math.constrain(fillAmount, 0, 25) | |
basic.clearScreen() | |
for (let i = 0; i < fillAmount; i++) { | |
let x = i % 5 | |
let y = Math.floor(i / 5) | |
led.plot(x, y) | |
} | |
basic.pause(1) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment