Screen Shot 2018-01-27 at 11.00.17 PM.png

Hi.

Welcome to my blog. Here, I document my daily blogs, learning experiences, and some fun projects.

Bluetooth LE + P5js

Bluetooth LE + P5js

In the past week, I had been obsessed with the show Bridgerton, especially the playlists and the music on the show. I decided maybe I could play with that for the assignment this week. I wanted to control the volume of the song 'Wildest Dreams' by Duomo which was played on the show. Totally in love with that song. And so I wondered if I could control the volume of the music on p5js web editor using the accelerometer data on the Nano 33 IOT.

I decided to use the Y coordinates to control the volume so that it gives a slider like feel on the screen. The preset volume on p5js ranges between 0 to 1 and so I mapped the data coming in from the Y axis between 0 to 0.9 on my p5js sketch.

function handleY(data) {

console.log('data: ', data);

positionY = map(Number(data),-100,100,0,0.9);


I then also wanted to have fun with some visuals on the sketch and give it more of a slider look. I added an image of the show to represent the volume slider and had it move horizontally as the Y axis on the Nano kept changing.


image(img, 15 + positionY*1000, windowHeight - 200,200,150);


I multiplied the position by 1000 for a more wider visual movement on the sketch.

Fast-Fun : Week 1 Audio MIDI

Fast-Fun : Week 1 Audio MIDI

Build a BLE service

Build a BLE service