Skip to content

Instantly share code, notes, and snippets.

@TheCuttlefish
Created April 1, 2025 21:56
Show Gist options
  • Save TheCuttlefish/9dc02ce394a568713d2487588b3f369c to your computer and use it in GitHub Desktop.
Save TheCuttlefish/9dc02ce394a568713d2487588b3f369c to your computer and use it in GitHub Desktop.
Show light sensor values 0-255 (makey makey + BBC:micro)
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