mirror of
https://github.com/alankrantas/microbit-micropython-cookbook.git
synced 2025-12-16 10:00:37 +01:00
Update README.md
This commit is contained in:
@@ -65,8 +65,10 @@ Try to type these in the REPL:
|
|||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Reference</summary>
|
<summary>Reference</summary>
|
||||||
- `import this` prints out "The Zen of MicroPython", which is a short version of [The Zen of Python](https://peps.python.org/pep-0020/) in CPython.
|
|
||||||
- `import antigravity` prints out a text version of [this comic about Python 2](https://xkcd.com/353/); in CPython it will directly open the URL of that comic.
|
- `import this` prints out "The Zen of MicroPython", which is a short version of [The Zen of Python](https://peps.python.org/pep-0020/) in CPython.
|
||||||
|
- `import antigravity` prints out a text version of [this comic about Python 2](https://xkcd.com/353/); in CPython it will directly open the URL of that comic.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Import * is a Bad Idea
|
## Import * is a Bad Idea
|
||||||
@@ -299,7 +301,7 @@ def translate(value, leftMin, leftMax, rightMin, rightMax):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
lightLevel = display.read_light_level()
|
lightLevel = display.read_light_level()
|
||||||
print(translate(lightLevel, 0, 255, 0, 1023))
|
print(translate(lightLevel, 0, 255, 0, 1023)) # map value range 0-255 to 0-1023
|
||||||
sleep(100)
|
sleep(100)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user