Actually the easiest way is to use free coding tool DroidScript with the free Puck.js plugin. Here is the code (taken from the Puck.js plugin docs)
app.LoadPlugin( "PuckJS" ); function OnStart() { lay = app.CreateLayout( "Linear", "VCenter,FillXY" ); var code = "digitalWrite( LED1, 1 )"; txt = app.CreateTextEdit( code, 0.9, 0.8, "MultiLine" ); lay.AddChild( txt ); app.AddLayout( lay ); layHoriz = app.CreateLayout( "Linear", "Horizontal" ); lay.AddChild( layHoriz ); btnSend = app.CreateButton( "Send", 0.3, 0.1 ); btnSend.SetOnTouch( btnSend_OnTouch ); layHoriz.AddChild( btnSend ); btnSave = app.CreateButton( "Save", 0.3, 0.1 ); btnSave.SetOnTouch( btnSave_OnTouch ); layHoriz.AddChild( btnSave ); btnReset = app.CreateButton( "Reset", 0.3, 0.1 ); btnReset.SetOnTouch( btnReset_OnTouch ); layHoriz.AddChild( btnReset ); microbit = app.CreatePuckJS(); microbit.Scan( "Puck" ); } function btnSend_OnTouch() { microbit.SendCode( txt.GetText() ); } function btnSave_OnTouch() { microbit.Save(); } function btnReset_OnTouch() { microbit.Reset(); }
@Dave_Smart started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Actually the easiest way is to use free coding tool DroidScript with the free Puck.js plugin.
Here is the code (taken from the Puck.js plugin docs)