-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
59 lines (43 loc) · 1.2 KB
/
sketch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var socket;
var translateKey;
function preload(){
loadJSON('creds.json', loadKeys);
}
function loadKeys(data) {
// console.log("data: ", data);
// console.log("ocrkey: ", data.ocrkey);
translateKey = data.translatekey;
// console.log('key : ', data.translatekey);
}
function setup() {
// recButton = createButton('Start recording');
// recButton.mousePressed(startRec);
// startRec();
// Start a socket connection to the server
socket = io.connect('http://localhost:8080');
ocrSetup();
socket.on('morseIn', function(data) {
translateToMorse(data);
});
// socket.on('translate', function(data) {
// // console.log("p5: " + data.str);
// // console.log("p5: " + data.sourceLang);
// // console.log("p5: " + data.targetLang);
// translateString(data.str, data.sourceLang, data.targetLang);
// });
socket.on('speak', function(data) {
speak(data.str, data.sourceLang);
});
socket.on('ocrPhoto', function(data) {
// setTimeout(saveScreen, 5000);
saveScreen(data);
});
socket.on('startRec', function() {
recResult = false;
startRec();
});
setInterval(startRec, 3000);
}
function togglePhone(data) {
socket.emit('togglePhone', data);
}