-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_buttons_customtext.js
57 lines (51 loc) · 3.4 KB
/
test_buttons_customtext.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
// Disable logging events to screen
Bluetooth.setConsole(1);
LED1.set();
Graphics.prototype.setFontPixeloidSans = function() {
// Actual height 9 (8 - 0)
return this.setFontCustom(
E.toString(require('heatshrink').decompress(atob('AAUfoEGgEBwEAkU/xGP8UggFkpN/6VE4EGmcgkEmscAhuJkdQiEUgFggEHwkkhEBgVCj0AikEgoxBkE4hAEBCgOAoAuBgIIB4GAwGBHwM+kGSpEj8EBgmCv4XCgUSjMUyUxgEIxEkCgPYgEMhUJh/goEB9GSpMkyOAgfiAoOSk0AiFIolCoPAgE2BYNJkZJB5AaCx+AgMQgFGGYMKhAIBoGgqCPBhUCgECgUBimQmChB5ElEAPkgEPjURg2A+EB/gsCxpHChJrBkQaCkkRiFwgF/I4UkiAaByFIAoMADQQOBh4aB4KJBoP8gFBn+QoCsBhEEBIM/wUCGIK5B/yzBXIUD/GAkEIAAKYBgf5DoMMgMf4BQEnw1B5IFBoCYBZwORpFD6BQCpklhlAgciWYsIg/yd4V+HwUndIPAjEDg0cgEHAwMwHwWfgEGmGgkEoscAjggB+DXCociyVKkyPB/2BoGAjDGBNIMMgDSBr4zBAAIHBT4MAkBJBAgIUBAYIAB8GIokUj6qCoMQxE4gEOhGEoUhD4M4kURgqPBDQOoqkqhsAgkP8olBCIORopyBg/woC3Ba4MXDQMQgkC3zOBwMBGoKhBHgLbBgPhJwM8BAMECwJ9BHwcIweADANQokih0AgeCKANQv4aBgQABIwNIKAMVhMAgRHBxEAniJBwFDMYUIC4IkC4EQiEwIgJaBgUgYgUigEMkOQagIcBk0VhWFoalBsH8YoUf8EEhUE/kYRwImBYQNAXIYACgN8d4MRj/EoQj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EAgYGBgYGBgYEBgYGBgYGBgY="),
9|65536
);
};
var PIN_BUZZER = A0;
var buzzerEnabled = false;
var buttonEnabled = false;
var buttonEnabled2 = false;
var buttonEnabled3 = false;
var buttonEnabled4 = false;
function switchBuzzerState1() {
buzzerEnabled = !buzzerEnabled;
if(buzzerEnabled) {
digitalWrite(PIN_BUZZER,255);
} else {
digitalWrite(PIN_BUZZER,0);
}
}
function display() {
g.clear();
g.setFontPixeloidSans();
g.drawString("Si vous pensez au dernier \npassage de train, avant la \nnotification, quelle note \ncomprise entre zéro et \ndix exprime le mieux la \nfaçon dont le bruit du \ntrain vous a gêné?",0,0);
let h=g.getHeight();
let w=g.getWidth();
if(buttonEnabled) {
g.drawRect(0,0,8,24);
}
if(buttonEnabled2) {
g.drawRect(w-8,0,w-1,24);
}
if(buttonEnabled4) {
g.drawRect(0,h-24,8,h-1);
}
if(buttonEnabled3) {
g.drawRect(w-8,h-24,w-1,h-1);
}
g.flip();
}
display();
setWatch(function(){buttonEnabled=!buttonEnabled;display();switchBuzzerState1();}, BTN, { repeat: true, edge: 'rising'});
setWatch(function(){buttonEnabled2=!buttonEnabled2;display();}, BTN2, { repeat: true, edge: 'rising'});
setWatch(function(){buttonEnabled3=!buttonEnabled3;display();}, BTN3, { repeat: true, edge: 'rising'});
setWatch(function(){buttonEnabled4=!buttonEnabled4;display();}, BTN4, { repeat: true, edge: 'rising'});