Apps

bitty controller

Dual D-pad Touchpad Touchpad, Sensor Data and Button

bitty controller lets you use your phone or tablet as a remote control for a micro:bit connected device like a 4Tronix Bit:Bot or the Kitronic micro:bit buggy from http://www.kitronic.co.uk. It's not just for vehicles though. You could use it to control all sorts of electronic devices provided the micro:bit is running suitable code. bitty controller gives you a choice of user interfaces too, so you can select a style of interface which is best suited to the machine you wish to control. Available interfaces include a classic dual d-pad game controller an analog touchpad, which gives you finer-grained control and an enhanced touchpad which can include data from up to 5 sensors and has an extra button.

Check the downloads page for ready to use hex files.

C/C++ code and MakeCode projects which can be used to create a suitable hex file are available for download and have associated tutorials.

Specifications

micro:bit code should respond to Bluetooth communication from the bitty controller application as described in this section. How the micro:bit code needs to respond to communication from bitty controller will depend on the hardware the micro:bit is connected to. Ready made hex files for use with the 4tronix Bit:Bot and the Kitronik Buggy and MOVE mini products are available from the downloads page.

In all cases, micro:bit code must include the Bluetooth event service. This is included by default by tools like MakeCode. Event codes and values used by the D-pad and touchpad controller UIs are as follows:

Dual D-Pad Controller

Event Code Name Value Name Comment
1104 MES_DPAD_CONTROLLER_ID 5 MES_DPAD_BUTTON_C_DOWN left hand pad, left button down
1104 MES_DPAD_CONTROLLER_ID 6 MES_DPAD_BUTTON_C_UP left hand pad, left button up
1104 MES_DPAD_CONTROLLER_ID 7 MES_DPAD_BUTTON_D_DOWN left hand pad, right button down
1104 MES_DPAD_CONTROLLER_ID 8 MES_DPAD_BUTTON_D_UP left hand pad, right button up
1104 MES_DPAD_CONTROLLER_ID 9 MES_DPAD_BUTTON_1_DOWN right hand pad, top button down
1104 MES_DPAD_CONTROLLER_ID 10 MES_DPAD_BUTTON_1_UP right hand pad, top button up
1104 MES_DPAD_CONTROLLER_ID 11 MES_DPAD_BUTTON_2_DOWN right hand pad, bottom button down
1104 MES_DPAD_CONTROLLER_ID 12 MES_DPAD_BUTTON_2_UP right hand pad, bottom button up

Touchpad Controller

Event Code Name Value Name Comment
9011 TOUCHPAD_MOTION Coded direction and magnitude N/A value[0]
-ve=back +ve=forwards range:0-10.
0=no movement forwards or backwards.
1 to 10=forward speed (1=slowest, 10=fastest)
-1 to -10 backwards
value[1]
-ve=left +ve=right
range:0-10
0-2=no movement left or right (deliberately less sensitive than fwd/bwd control)
+/- 3-8 gradually increasing turn
+/- 9-10 sharp turn
9012 TOUCHPAD_CONTROL value[0]=0 value[1]=1 TOUCHED Touchpad controller ball was pressed in central position
9012 TOUCHPAD_CONTROL value[0]=0 value[1]=0 RELEASED Touchpad controller ball was released

Sensor Values

These events may be sent by the micro:bit to Bitty Controller. The value field contains a 10 bit sensor value in bits 0-9 and a 3 bit sensor number in bits 10-12. The sensor value must be in the range 0-1023, with 0 representing the minimum value that sensor can deliver and 1023 the maximum. This allows sensor cells to be colour coded according to where a received value is in this range. Formulae which can be set from the ioptions screen can be used to translate these raw values into something more suitabled for display.

Event Code Name Value Name Comment
9014 SENSOR_VALUE 1 CONTROL_TARGET_1_ON Extra Button on enhanced touchpad pressed
9013 OTHER CONTROL EVENT 2 CONTROL_TARGET_1_OFF Extra Button on enhanced touchpad released
9014 SENSOR_VALUE Composite sensor number and value sensor number (bits 10-12) and sensor value (bits 0-9)

Other Control Events

Event Code Name Value Name Comment
9013 OTHER CONTROL EVENT 1 CONTROL_TARGET_1_ON Extra Button on enhanced touchpad pressed
9013 OTHER CONTROL EVENT 2 CONTROL_TARGET_1_OFF Extra Button on enhanced touchpad released
9015 SENSOR SAMPLING START EVENT 1 Instructs the micro:bit to start sampling from its sensors.

bitty controller downloads

Get the app for Android here

Get the app for iOS here

Kitronik - C/C++ micro:bit source code

4tronix - C/C++ micro:bit source code

Hex files

Follow the micro:bit tutorial for bitty controller

Video