Skip to content

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

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3179bb0
Create watchface
BK7175 Apr 9, 2025
8fdbccb
Create readme.txt
BK7175 Apr 9, 2025
b625e91
Add files via upload
BK7175 Apr 9, 2025
5a8003c
Create app.js
BK7175 Apr 21, 2025
01b0751
Add files via upload
BK7175 Apr 21, 2025
a02d1b8
Create app-icon.js
BK7175 Apr 21, 2025
781860f
Create metadata.json
BK7175 Apr 21, 2025
20b3dde
Create README.md
BK7175 Apr 21, 2025
5ce62b2
Update app.js
BK7175 Apr 21, 2025
327a1f9
Update README.md
BK7175 Apr 21, 2025
ea406d4
Merge branch 'espruino:master' into master
BK7175 Apr 21, 2025
a5a7aa3
Delete apps/Buzzerapp/App.png
BK7175 Apr 21, 2025
de8e90f
Create app.png
BK7175 Apr 21, 2025
77843db
Add files via upload
BK7175 Apr 21, 2025
ced2fde
Update metadata.json
BK7175 Apr 21, 2025
e99298b
Create ChangeLog
BK7175 Apr 21, 2025
f873dab
Update metadata.json
BK7175 Apr 21, 2025
4f4615d
Update app-icon.js
BK7175 Apr 21, 2025
4531014
Create Buzzer.info
BK7175 Apr 21, 2025
21ef0b3
Delete apps/Buzzerapp/metadata.json
BK7175 Apr 21, 2025
017dd8e
Create Buzzer.app.js
BK7175 Apr 21, 2025
c8dab3c
Delete apps/Buzzerapp/app.js
BK7175 Apr 21, 2025
f5d7029
Delete apps/Buzzerapp/app.png
BK7175 Apr 21, 2025
5007c93
Create Buzzer.img
BK7175 Apr 21, 2025
14c44e6
Update Buzzer.info
BK7175 Apr 21, 2025
2a5277c
Update Buzzer.info
BK7175 Apr 22, 2025
6d7224c
Merge branch 'espruino:master' into master
BK7175 Apr 22, 2025
7c444cf
Update Buzzer.info
BK7175 Apr 22, 2025
9c1f2ef
Delete apps/Buzzerapp/app-icon.js
BK7175 Apr 22, 2025
be06808
Add files via upload
BK7175 Apr 22, 2025
d80ccbe
Update Buzzer.info
BK7175 Apr 22, 2025
ad2accb
Update Buzzer.info
BK7175 Apr 22, 2025
0c20b8b
Update Buzzer.info
BK7175 Apr 22, 2025
21fcc8f
Merge branch 'espruino:master' into master
BK7175 Apr 22, 2025
6f6e5c5
Update Buzzer.info
BK7175 Apr 22, 2025
def2471
Update Buzzer.info
BK7175 Apr 22, 2025
308ac05
Update Buzzer.info
BK7175 Apr 22, 2025
bca7acc
Create Buzzerapp.app.js
BK7175 Apr 22, 2025
29e82fe
Delete apps/Buzzerapp/Buzzer.app.js
BK7175 Apr 22, 2025
3e54093
Create app-icon.js
BK7175 Apr 22, 2025
59cc738
Delete apps/Buzzerapp/Buzzer.img
BK7175 Apr 22, 2025
6aa823d
Update Buzzer.info
BK7175 Apr 22, 2025
c17dc2c
Update and rename Buzzer.info to metadata.json
BK7175 Apr 22, 2025
663d8e5
Rename Buzzerapp.app.js to app.js
BK7175 Apr 22, 2025
5a5e185
Update app-icon.js
BK7175 Apr 22, 2025
b517f80
Delete apps/Buzzerapp/app.png
BK7175 Apr 22, 2025
7e00fb6
Add files via upload
BK7175 Apr 22, 2025
a318dbe
Delete apps/Buzzerapp/app.png
BK7175 Apr 22, 2025
60c7023
Add files via upload
BK7175 Apr 22, 2025
27469ea
Update app-icon.js
BK7175 Apr 22, 2025
35e7638
Update app.js
BK7175 Apr 23, 2025
2d15af4
Merge branch 'espruino:master' into master
BK7175 Apr 23, 2025
a1da174
Merge branch 'espruino:master' into master
BK7175 Apr 27, 2025
d663c37
Update ChangeLog
BK7175 Apr 27, 2025
8ff9701
Delete apps/1watchface directory
BK7175 Apr 27, 2025
a4f912f
Update README.md
BK7175 Apr 27, 2025
ab9b5af
Update README.md
BK7175 Apr 27, 2025
42fefbd
Update metadata.json
BK7175 Apr 29, 2025
e416acc
Delete apps/watchface
BK7175 Apr 29, 2025
ea6a5ac
Update README.md
BK7175 Apr 29, 2025
2766ffc
Update README.md
BK7175 Apr 29, 2025
7aebe85
Create puckjs-code
BK7175 Apr 29, 2025
1c94e82
Merge branch 'espruino:master' into master
BK7175 Apr 29, 2025
f6a4ef9
Rename puckjs-code to puckjs-code.md
BK7175 Apr 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/Buzzerapp/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.01: New App
24 changes: 24 additions & 0 deletions apps/Buzzerapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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

During the quiz round, each student group is provided with a response button (puck), while the teacher operates a central control device (referred to as the "bangle"). When a student presses their group’s puck, the system registers the response time and displays the order in which each group responded—first, second, and so on—on the teacher's bangle screen. This setup ensures a fair and transparent method for determining which team answered first.

## Features

A dashboard where every puck show who press first, second so on..,
Different Vibration type

## Controls

Bangle button for every new round of quiz

## Requests

BK7175

## Creator

Brijesh
1 change: 1 addition & 0 deletions apps/Buzzerapp/app-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions apps/Buzzerapp/app.js
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();
Binary file added apps/Buzzerapp/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions apps/Buzzerapp/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ "id": "Buzzerapp",
"name": "Buzzer APP",
Copy link
Collaborator

Choose a reason for hiding this comment

The 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?

"icon": "app.png",
"version":"0.01",
"description": "Quiz buzzer for school student",
"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}
]
}
15 changes: 15 additions & 0 deletions apps/Buzzerapp/puckjs-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const PUCK_NAME = "Puck A"; // Change to "Puck B", "Puck C" on others
let lastSent = 0;

function sendBuzz() {
if (Date.now() - lastSent < 3000) return; // 3s cooldown
lastSent = Date.now();
let msg = JSON.stringify({ buzz: true, name: PUCK_NAME });
Bluetooth.println(msg);
LED.set(); setTimeout(() => LED.reset(), 200);
}

setWatch(sendBuzz, BTN, { edge: "rising", repeat: true, debounce: 50 });

NRF.setAdvertising({}, { name: PUCK_NAME, connectable: true });
console.log(PUCK_NAME + " ready!");