pxt-calliope/docs/projects/light-level-meter.md

19 lines
340 B
Markdown
Raw Normal View History

# Light Level Meter
2017-02-10 02:40:21 +01:00
Use this program to graph the light level.
Press ``A`` to scroll the value on the screen.
2017-02-10 02:40:21 +01:00
```blocks
let reading = 0
2017-02-10 02:40:21 +01:00
basic.forever(() => {
reading = input.lightLevel()
2017-02-10 02:40:21 +01:00
led.plotBarGraph(
reading,
255
2017-02-10 02:40:21 +01:00
)
if (input.buttonIsPressed(Button.A)) {
basic.showNumber(reading)
}
2017-02-10 02:40:21 +01:00
})
```