Bluetooth WIP
parent
13f4902644
commit
5c9f3fb79d
|
@ -16,3 +16,10 @@ Also see https://git.kompot.si/g1smo/pifcamp-2021
|
|||
The original animation, modularized with sliders, was first "exhibited" on [[https://radiostudent.si/kultura/humanistika/delo-in-tehnologija][october 6th 2017]] in [[http://atrog.org/prostori/modri-kot][Modri kot]], a beautiful space for performance that used to be on the side of the [[https://tovarna.org/][autonomous factory Rog]] in Ljubljana, which was evicted by force on january 19th 2021 by the municipality to pave way for future gentrification.
|
||||
Special thanks to Zala and Lio for hosting me during early development and Tisa Neža for curating the first performance.
|
||||
|
||||
* bluetooth
|
||||
1. Pair the device (named "wavey wind")
|
||||
2. Find the MAC address
|
||||
3. Add a serial port (change MAC accordingly)
|
||||
`sudo rfcomm bind 0 98:CD:AC:63:78:9A`
|
||||
4. Run the server with the bluetooth address
|
||||
`node server.js /dev/rfcomm0`
|
||||
|
|
18
server.js
18
server.js
|
@ -2,6 +2,8 @@ const express = require('express')
|
|||
const http = require('http')
|
||||
const WebSocket = require('ws')
|
||||
const osc = require('osc')
|
||||
const readline = require('readline')
|
||||
const fs = require('fs')
|
||||
|
||||
const port = 6676
|
||||
// Vzemi iz argumenta
|
||||
|
@ -28,7 +30,7 @@ function openSerial() {
|
|||
console.log('opening ', tty)
|
||||
scon = new osc.SerialPort({
|
||||
devicePath: tty,
|
||||
bitrate: 115200,
|
||||
//bitrate: 115200,
|
||||
autoOpen: true
|
||||
})
|
||||
scon.open()
|
||||
|
@ -66,7 +68,19 @@ function openSerial() {
|
|||
}
|
||||
}
|
||||
|
||||
openSerial()
|
||||
function openBT() {
|
||||
console.log('opening bluetooth', tty)
|
||||
const rl = readline.createInterface({
|
||||
input: fs.createReadStream(tty)
|
||||
})
|
||||
|
||||
rl.on('line', (line) => {
|
||||
console.log('Got line', line)
|
||||
})
|
||||
}
|
||||
|
||||
//openSerial()
|
||||
openBT()
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.sendFile(__dirname + '/index.html');
|
||||
|
|
Loading…
Reference in New Issue