The full Johnny-Five nodebots library for p5.js!
Works directly in a web page via webUSB. No servers required.
include p5 and p5.j5 in your web page:
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.min.js"></script>
<script src="https://unpkg.com/p5.j5@1.0.0/dist/p5.j5.min.js"></script>
</head>
add some javascript:
let sensorVal = 0;
function preload() {
loadBoard();
}
function setup() {
const sensor = new five.Sensor('A0');
sensor.on('change', () => {
sensorVal = sensor.scaleTo(0, 300);
});
createCanvas(400, 400);
}
function draw() {
background('blue');
rect(50, 150, sensorVal, 100);
}
Currently p5.j5 supports webUSB capable boards
You'll need the webUSB firmata sketch loaded onto your board.
Johnny-Five related libraries bundled in:
Currently webUSB is working great, but would be nice to have web bluetooth support via ble-io