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:
2016-04-13 17:27:45 +02:00
* [the Touch Develop Editor ](/js/editor )
* [30+ BBC micro:bit lessons ](/lessonss )
* [offline support ](/offline )
2016-03-26 00:47:20 +01:00
### ~column
## Language {#pconst}
### Variables
2016-04-13 17:27:45 +02:00
* [local variables ](/reference/variables/var )
* [global variables ](/js/data )
2016-03-26 00:47:20 +01:00
### Types
2016-04-13 17:27:45 +02:00
* [Number ](/reference/types/number )
* [Boolean ](/reference/types/boolean )
* [String ](/reference/types/string )
2016-04-16 00:02:26 +02:00
* [Image ](/reference/images/image )
2016-03-26 00:47:20 +01:00
### Statements and control structures
2016-04-13 17:27:45 +02:00
* [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 )
2016-03-26 00:47:20 +01:00
### Maths
2016-04-13 17:27:45 +02:00
* 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
2016-03-26 00:47:20 +01:00
### Logical
2016-04-13 17:27:45 +02:00
* [Boolean ](/reference/types/boolean ) values `true` and `false`
* Operations (`not`, `or` , `and` ) on [Booleans ](/reference/types/boolean )
2016-03-26 00:47:20 +01:00
### Strings
2016-04-13 17:27:45 +02:00
* [string functions ](/reference/types/string-functions )
2016-03-26 00:47:20 +01:00
### Functions
2016-04-13 17:27:45 +02:00
* [create a function ](/js/function )
* [function parameters ](/js/functionparameters )
* [call a function ](/js/call )
2016-03-26 00:47:20 +01:00
### Collections
2016-04-13 17:27:45 +02:00
* read the [collections tutorial ](/js/collections )
2016-03-26 00:47:20 +01:00
### Custom object types
2016-04-13 17:27:45 +02:00
* see the [object types tutorial ](/js/object-types )
* read the [object disclaimer ](/js/object-disclaimer ) if you're an advanced user
2016-03-26 00:47:20 +01:00
### Libraries
2016-04-13 17:27:45 +02:00
* [create and use libraries ](/js/libraries )
2016-03-26 00:47:20 +01:00
### Documentation
2016-04-13 17:27:45 +02:00
* [comments ](/js/comment )
* [markdown syntax ](/js/markdown )
2016-03-26 00:47:20 +01:00
### ~
### ~column
## BBC micro:bit functions
### Basic
2016-04-13 17:27:45 +02:00
* [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 )
2016-03-26 00:47:20 +01:00
### LED
2016-04-13 17:27:45 +02:00
* [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 )
2016-03-26 00:47:20 +01:00
### Input
2016-04-13 17:27:45 +02:00
* [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 logo down ](/functions/on-logo-down )
* [on logo up ](/functions/on-logo-up )
* [on pin pressed ](/reference/input/on-pin-pressed )
* [on screen down ](/functions/on-screen-down )
* [on screen up ](/functions/on-screen-up )
* [pin is pressed ](/reference/input/pin-is-pressed )
2016-03-26 00:47:20 +01:00
### Image
2016-04-13 17:27:45 +02:00
* [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 )
2016-03-26 00:47:20 +01:00
### Music
2016-04-13 17:27:45 +02:00
* [play note ](/functions/play-note )
* [note ](/functions/note )
* [ring ](/reference/music/ring )
2016-03-26 00:47:20 +01:00
### Pins
2016-04-13 17:27:45 +02:00
* [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 )
2016-03-26 00:47:20 +01:00
### Control
2016-04-13 17:27:45 +02:00
* [in background ](/reference/control/in-background )
* [reset ](/functions/reset )
2016-03-26 00:47:20 +01:00
### Devices
Functions in this category require to be connected to a remote device.
2016-04-13 17:27:45 +02:00
* [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 )
2016-03-26 00:47:20 +01:00
### Libraries
2016-04-13 17:27:45 +02:00
* [serial library ](/js/serial-library )
2016-03-26 00:47:20 +01:00
### ~
### ~column
## Run
2016-04-13 17:27:45 +02:00
* [scripts in the browser ](/js/simulator )
* [scripts on your BBC micro:bit ](/device/usb )
2016-03-26 00:47:20 +01:00
## Debugging
2016-04-13 17:27:45 +02:00
* use the [serial library ](/js/serial-library ) to print data from your micro:bit on your computer
* learn about the [device error codes ](/device/errors ) that are displayed when sad faces occur
2016-03-26 00:47:20 +01:00
## Edit/Publish
2016-04-13 17:27:45 +02:00
* [the Touch Develop Editor ](/js/editor )
* [publish a script ](/js/publishing )
2016-03-26 00:47:20 +01:00
## Creating Tutorials
2016-04-13 17:27:45 +02:00
* [create a tutorial ](/js/create-tutorials )
* [markdown syntax ](/js/markdown )
2016-03-26 00:47:20 +01:00
### ~