Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ubitWebBLE

Add the bluetoothconnection.js and the to your p5.js project root directory don't forget to include the line <script src="bluetoothconnection.js"></script> in your index.html so the browser actually reads the file bluetoothconnection.js add this line in setup: setupBLE() This will add a button to you sketch for connecting to your micro:bit

now to send data from p5js to microbit use: microBitWriteString("whatever you want to send" + "\n"); // sends "A" to the micro:bit

to receive data over bluetooth add these functions in your sketch.js

// to receive a string function onReceivedString(receivedString) { //do something with receivedString }

//to receive a name + value function onBluetoothReceivedValue(name, value) { //do something with name and value }

when coding your micro:bit use the bluetooth extension. "bluetooth uart write line" to send data.

if the text you send has a name and a value seperated with a colon like this "name:10" it will trigger the onBluetoothReceivedValue(name, value) function in yout p5 sketch

example microbit code to use with the example sketch: https://makecode.microbit.org/S35950-77875-77206-59357

other stuff: if you want to reposition the connect button, do this: connectButton.position(x,y)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages