212 lines
5.5 KiB
Markdown
212 lines
5.5 KiB
Markdown
# @boardname@/JavaScript Documentation
|
|
|
|
JavaScript docs for the @boardname@
|
|
|
|
### @section full
|
|
|
|
### @parent reference
|
|
|
|
### @short JavaScript
|
|
|
|
### ~hint
|
|
|
|
**Spotty internet? No problem!** (1) When online, go to https://www.microbit.co.uk/app/ and bookmark this URL; (2) use the bookmark to reload the web app, even without the internet.
|
|
|
|
### ~
|
|
|
|
Welcome to the Touch Develop home page for the @boardname@. Below you will find resources about the Touch Develop programming language and code editor. Good places to start include:
|
|
|
|
* [the Touch Develop Editor](/js/editor)
|
|
* [30+ @boardname@ lessons](/lessonss)
|
|
* [offline support](/offline)
|
|
|
|
### ~column
|
|
|
|
## Language {#pconst}
|
|
|
|
### Variables
|
|
|
|
* [local variables](/reference/variables/var)
|
|
* [global variables ](/js/data)
|
|
|
|
### Types
|
|
|
|
* [Number](/reference/types/number)
|
|
* [Boolean](/reference/types/boolean)
|
|
* [String](/reference/types/string)
|
|
* [Image](/reference/images/image)
|
|
|
|
### Statements and control structures
|
|
|
|
* [assignment operator](/reference/variables/assign) `:=`
|
|
* [if](/reference/logic/if)
|
|
* [for](/reference/loops/for)
|
|
* [while](/js/while)
|
|
* [break](/js/break)
|
|
* [forever](/reference/basic/forever)
|
|
* [in background](/reference/control/in-background)
|
|
* [function](/js/function)
|
|
* [return](/js/return)
|
|
|
|
### Maths
|
|
|
|
* arithmetic operators (`+`, `-`, `*`, `/`, mod) on [Numbers](/reference/types/number)
|
|
* comparison operators (such as `>`, `=`) on [Numbers](/reference/types/number)
|
|
* the [math](/js/math) library
|
|
* the [bits](/js/bits) library
|
|
|
|
### Logical
|
|
|
|
* [Boolean](/reference/types/boolean) values `true` and `false`
|
|
* Operations (`not`, `or`, `and`) on [Booleans](/reference/types/boolean)
|
|
|
|
### Strings
|
|
|
|
* [string functions](/reference/types/string-functions)
|
|
|
|
### Functions
|
|
|
|
* [create a function](/js/function)
|
|
* [function parameters](/js/functionparameters)
|
|
* [call a function](/js/call)
|
|
|
|
### Collections
|
|
|
|
* read the [collections tutorial](/js/collections)
|
|
|
|
### Custom object types
|
|
|
|
* see the [object types tutorial](/js/object-types)
|
|
* read the [object disclaimer](/js/object-disclaimer) if you're an advanced user
|
|
|
|
### Libraries
|
|
|
|
* [create and use libraries](/js/libraries)
|
|
|
|
### Documentation
|
|
|
|
* [comments](/js/comment)
|
|
* [markdown syntax](/js/markdown)
|
|
|
|
### ~
|
|
|
|
### ~column
|
|
|
|
## @boardname@ functions
|
|
|
|
### Basic
|
|
|
|
* [clear screen](/reference/basic/clear-screen)
|
|
* [forever](/reference/basic/forever)
|
|
* [pause](/reference/basic/pause)
|
|
* [show leds](/reference/basic/show-leds)
|
|
* [show animation](/reference/basic/show-animation)
|
|
* [show number](/reference/basic/show-number)
|
|
* [show string](/reference/basic/show-string)
|
|
|
|
### LED
|
|
|
|
* [brightness](/reference/led/brightness)
|
|
* [fade in](/reference/led/fade-in)
|
|
* [fade out](/reference/led/fade-out)
|
|
* [plot](/reference/led/plot)
|
|
* [plot all](/reference/led/plot-all)
|
|
* [point](/reference/led/point)
|
|
* [screenshot](/functions/screenshot)
|
|
* [set display mode](/functions/set-display-mode)
|
|
* [set brightness](/reference/led/set-brightness)
|
|
* [stop animation](/reference/led/stop-animation)
|
|
* [toggle](/reference/led/toggle)
|
|
* [toggle all](/reference/led/toggle-all)
|
|
* [unplot](/reference/led/unplot)
|
|
|
|
### Input
|
|
|
|
* [acceleration](/reference/input/acceleration)
|
|
* [rotation](/functions/rotation)
|
|
* [button is pressed](/reference/input/button-is-pressed)
|
|
* [compass heading](/reference/input/compass-heading)
|
|
* [temperature](/reference/input/temperature)
|
|
* [running time](/reference/input/running-time)
|
|
* [on shake](/reference/input/on-gesture)
|
|
* [on button pressed](/reference/input/on-button-pressed)
|
|
* [on pin pressed](/reference/input/on-pin-pressed)
|
|
* [pin is pressed](/reference/input/pin-is-pressed)
|
|
|
|
### Image
|
|
|
|
* [create image](/reference/images/create-image)
|
|
* [clear](/reference/basic/clear-screen)
|
|
* [pixel](/reference/images/pixel)
|
|
* [plot frame](/reference/led/plot-frame)
|
|
* [plot image](/reference/led/plot-image)
|
|
* [scroll image](/reference/images/scroll-image)
|
|
* [show frame](/functions/show-frame)
|
|
* [set pixel](/reference/images/set-pixel)
|
|
* [show image](/reference/images/show-image)
|
|
* [width](/functions/width)
|
|
|
|
### Music
|
|
|
|
* [play note](/functions/play-note)
|
|
* [note](/functions/note)
|
|
* [ring](/reference/music/ring)
|
|
|
|
### Pins
|
|
|
|
* [digital read pin](/reference/pins/digital-read-pin)
|
|
* [digital write pin](/reference/pins/digital-write-pin)
|
|
* [analog read pin](/reference/pins/analog-read-pin)
|
|
* [analog write pin](/reference/pins/analog-write-pin)
|
|
* [analog set period](/reference/pins/analog-set-period)
|
|
* [analog pitch](/reference/pins/analog-pitch)
|
|
* [analog set pitch pin](/reference/pins/analog-set-pitch-pin)
|
|
* [servo write pin](/reference/pins/servo-write-pin)
|
|
* [servo set pulse](/reference/pins/servo-set-pulse)
|
|
* [map](/functions/map)
|
|
|
|
### Control
|
|
|
|
* [in background](/reference/control/in-background)
|
|
* [reset](/functions/reset)
|
|
|
|
### Devices
|
|
|
|
Functions in this category require to be connected to a remote device.
|
|
|
|
* [tell camera to](/reference/devices/tell-camera-to)
|
|
* [tell remote control to](/reference/devices/tell-remote-control-to)
|
|
* [raise alert to](/reference/devices/raise-alert-to)
|
|
* [on notified](/reference/devices/on-notified)
|
|
|
|
### Libraries
|
|
|
|
* [serial library](/js/serial-library)
|
|
|
|
### ~
|
|
|
|
### ~column
|
|
|
|
## Run
|
|
|
|
* [scripts in the browser](/js/simulator)
|
|
* [scripts on your @boardname@](/device/usb)
|
|
|
|
## Debugging
|
|
|
|
* use the [serial library](/js/serial-library) to print data from your @boardname@ on your computer
|
|
* learn about the [device error codes](/device/errors) that are displayed when sad faces occur
|
|
|
|
## Edit/Publish
|
|
|
|
* [the Touch Develop Editor](/js/editor)
|
|
* [publish a script](/js/publishing)
|
|
|
|
## Creating Tutorials
|
|
|
|
* [create a tutorial](/js/create-tutorials)
|
|
* [markdown syntax](/js/markdown)
|
|
|
|
### ~
|
|
|