-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Buzzerapp #3820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Buzzerapp #3820
Changes from 57 commits
3179bb0
8fdbccb
b625e91
5a8003c
01b0751
a02d1b8
781860f
20b3dde
5ce62b2
327a1f9
ea406d4
a5a7aa3
de8e90f
77843db
ced2fde
e99298b
f873dab
4f4615d
4531014
21ef0b3
017dd8e
c8dab3c
f5d7029
5007c93
14c44e6
2a5277c
6d7224c
7c444cf
9c1f2ef
be06808
d80ccbe
ad2accb
0c20b8b
21fcc8f
6f6e5c5
def2471
308ac05
bca7acc
29e82fe
3e54093
59cc738
6aa823d
c17dc2c
663d8e5
5a5e185
b517f80
7e00fb6
a318dbe
60c7023
27469ea
35e7638
2d15af4
a1da174
d663c37
8ff9701
a4f912f
ab9b5af
42fefbd
e416acc
ea6a5ac
2766ffc
7aebe85
1c94e82
f6a4ef9
987a1de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 0.01: New App |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Buzzerapp | ||
|
|
||
| Basically it use with puckjs for specially Quize round in school where student have to press the puck and Bangle show on it screen that who press first, second like... that | ||
| Main aim through this app is need to aware about the student how technology simply is working back side of this regular daily usage devices | ||
| ## Usage | ||
|
|
||
| Specially in Quize round in school where student have to press the puck and Bangle show on it screen that who press first, second like that.. | ||
| Teacher have a one bangle and other group of student have a one puck each in group. | ||
|
|
||
| ## Features | ||
|
|
||
| A dashboard where every puck show who press first, second.... | ||
| Different Vibration type | ||
|
|
||
| ## Controls | ||
|
|
||
| Bangle button for every new round of quize | ||
|
|
||
| ## Requests | ||
|
|
||
| BK7175 | ||
|
|
||
| ## Creator | ||
|
|
||
| Brijesh | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| Bluetooth.setConsole(false); | ||
| g.clear(); | ||
| g.setFont("6x8", 2); | ||
|
|
||
| let buzzedList = []; | ||
|
|
||
| // Decode DataView to string (safe for BLE characteristic) | ||
| function decodeBLEString(dataView) { | ||
| let s = ""; | ||
| for (let i = 0; i < dataView.byteLength; i++) { | ||
| s += String.fromCharCode(dataView.getUint8(i)); | ||
| } | ||
| return s; | ||
| } | ||
|
|
||
| // Display buzzed order | ||
| function updateDisplay() { | ||
| g.clear(); | ||
| g.drawString("📋 Buzz Order:", 10, 10); | ||
| buzzedList.forEach((name, i) => { | ||
| g.drawString((i + 1) + ". " + name, 10, 30 + i * 20); | ||
| }); | ||
| if (buzzedList.length === 0) { | ||
| g.drawString("Waiting for buzzers...", 10, 50); | ||
| } | ||
| } | ||
|
|
||
| // Feedback for buzzed-in | ||
| function alertForRank(rank) { | ||
| if (rank === 0) { | ||
| Bangle.buzz(500); | ||
| Bangle.beep(); | ||
| setTimeout(() => Bangle.beep(), 200); | ||
| } else { | ||
| Bangle.buzz(150); | ||
| } | ||
| } | ||
|
|
||
| // Scan for Puck.js devices one by one | ||
| function scanForBuzzers() { | ||
| NRF.requestDevice({ filters: [{ namePrefix: "Puck" }], timeout: 20000 }) | ||
| .then(device => device.gatt.connect() | ||
| .then(gatt => gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e")) | ||
| .then(service => service.getCharacteristic("6e400003-b5a3-f393-e0a9-e50e24dcca9e")) | ||
| .then(characteristic => { | ||
| characteristic.on('characteristicvaluechanged', event => { | ||
| let value = decodeBLEString(event.target.value); | ||
| try { | ||
| let msg = JSON.parse(value); | ||
| if (msg.buzz && msg.name && !buzzedList.includes(msg.name)) { | ||
| buzzedList.push(msg.name); | ||
| alertForRank(buzzedList.length - 1); | ||
| updateDisplay(); | ||
| } | ||
| } catch (e) { | ||
| print("Parse error:", value); | ||
| } | ||
|
|
||
| // Disconnect safely after receiving | ||
| let device = characteristic.device; | ||
| if (device && device.gatt && device.gatt.connected) { | ||
| device.gatt.disconnect(); | ||
| } | ||
| setTimeout(scanForBuzzers, 1000); | ||
| }); | ||
| return characteristic.startNotifications(); | ||
| }) | ||
| ) | ||
| .catch(err => { | ||
| print("Scan/connect failed:", err); | ||
| setTimeout(scanForBuzzers, 2000); | ||
| }); | ||
| } | ||
|
|
||
| // Button on Bangle to reset round | ||
| setWatch(() => { | ||
| buzzedList = []; | ||
| updateDisplay(); | ||
| scanForBuzzers(); | ||
| }, BTN, { repeat: true, edge: "rising", debounce: 50 }); | ||
|
|
||
| // Start initial scan | ||
| updateDisplay(); | ||
| scanForBuzzers(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { "id": "Buzzerapp", | ||
| "name": "Buzzer APP", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rename to "Quiz buzzer" or something. Buzzing is used for many things, I think it would help to specify the usecase a bit by a more descriptive name. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BK7175 what do you think about this name change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thyttan Ohk, I have no issue, I agree. |
||
| "shortName":"Bapp", | ||
BK7175 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "icon": "app.png", | ||
| "version":"0.01", | ||
| "description": "This is my buzzer app", | ||
BK7175 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| "tags": "tool", | ||
| "supports" : ["BANGLEJS", "BANGLEJS2"], | ||
| "readme": "README.md", | ||
| "storage": [ | ||
| {"name":"Buzzerapp.app.js","url":"app.js"}, | ||
| {"name":"Buzzerapp.img","url":"app-icon.js","evaluate":true} | ||
| ] | ||
| } | ||
BK7175 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.