-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.js
87 lines (70 loc) · 2.31 KB
/
demo.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
let fs = require('fs/promises')
let path = require('path')
let { Plinth, imageUtilities } = require('.')
async function main() {
let plinth = new Plinth('devkit')
let erase = function(well) {
console.log('erasing well', well.id)
let buf = Buffer.alloc(4096, ' '.charCodeAt(0))
buf[0] = '{'.charCodeAt(0)
buf[1] = '}'.charCodeAt(0)
well._writeMemory(buf)
console.log('erased well', well.id)
}
//erase(plinth.wells[0])
console.log(plinth.wells[0].getData())
plinth.wells[0].storeData({ hello: 'chukwudi'})
console.log(plinth.wells[0].getData())
plinth.wells[0].storeData({ hello: 'chukwudi', ohyeah: 'coolaid'})
console.log(plinth.wells[0].getData())
}
main()
// let fs = require('fs/promises')
// let path = require('path')
// let { Plinth, imageUtilities } = require('./')
// async function main() {
// let plinth = new Plinth('prototype')
// let displayRandomImage = function(well) {
// return async () => {
// let image = await imageUtilities.randomImage()
// plinth.wells[well].displayImage(image)
// }
// }
// let getData = function(well) {
// return () => {
// let data = well.getData()
// return data
// }
// }
// let erase = function(well) {
// console.log('erasing well', well.id)
// let buf = Buffer.alloc(4096, ' '.charCodeAt(0))
// buf[0] = '{'.charCodeAt(0)
// buf[1] = '}'.charCodeAt(0)
// well._writeMemory(buf)
// console.log('erased well', well.id)
// }
// let logCallbackPress = function(well, buttonId) {
// return async () => {
// console.log('logging button press by callback: well', well.id, buttonId)
// }
// }
// let logEventPress = function(well) {
// return (e) => {
// console.log('logging button press by event: well', e.well, e.button)
// }
// }
// let logEventChordedPress = function(well) {
// return (e) => {
// console.log('logging chorded button press by event: well', e.well, e.buttons)
// }
// }
// plinth.wells.forEach((well, i) => {
// well.onAButtonPress(logCallbackPress(well, 'a'))
// well.onBButtonPress(logCallbackPress(well, 'b'))
// well.onCButtonPress(logCallbackPress(well, 'c'))
// well.on('buttonPress', logEventPress(well))
// well.on('chordedButtonPress', logEventChordedPress(well))
// })
// }
//main()