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