-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
BK7175
wants to merge
64
commits into
espruino:master
Choose a base branch
from
BK7175:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Buzzerapp #3820
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
3179bb0
Create watchface
BK7175 8fdbccb
Create readme.txt
BK7175 b625e91
Add files via upload
BK7175 5a8003c
Create app.js
BK7175 01b0751
Add files via upload
BK7175 a02d1b8
Create app-icon.js
BK7175 781860f
Create metadata.json
BK7175 20b3dde
Create README.md
BK7175 5ce62b2
Update app.js
BK7175 327a1f9
Update README.md
BK7175 ea406d4
Merge branch 'espruino:master' into master
BK7175 a5a7aa3
Delete apps/Buzzerapp/App.png
BK7175 de8e90f
Create app.png
BK7175 77843db
Add files via upload
BK7175 ced2fde
Update metadata.json
BK7175 e99298b
Create ChangeLog
BK7175 f873dab
Update metadata.json
BK7175 4f4615d
Update app-icon.js
BK7175 4531014
Create Buzzer.info
BK7175 21ef0b3
Delete apps/Buzzerapp/metadata.json
BK7175 017dd8e
Create Buzzer.app.js
BK7175 c8dab3c
Delete apps/Buzzerapp/app.js
BK7175 f5d7029
Delete apps/Buzzerapp/app.png
BK7175 5007c93
Create Buzzer.img
BK7175 14c44e6
Update Buzzer.info
BK7175 2a5277c
Update Buzzer.info
BK7175 6d7224c
Merge branch 'espruino:master' into master
BK7175 7c444cf
Update Buzzer.info
BK7175 9c1f2ef
Delete apps/Buzzerapp/app-icon.js
BK7175 be06808
Add files via upload
BK7175 d80ccbe
Update Buzzer.info
BK7175 ad2accb
Update Buzzer.info
BK7175 0c20b8b
Update Buzzer.info
BK7175 21fcc8f
Merge branch 'espruino:master' into master
BK7175 6f6e5c5
Update Buzzer.info
BK7175 def2471
Update Buzzer.info
BK7175 308ac05
Update Buzzer.info
BK7175 bca7acc
Create Buzzerapp.app.js
BK7175 29e82fe
Delete apps/Buzzerapp/Buzzer.app.js
BK7175 3e54093
Create app-icon.js
BK7175 59cc738
Delete apps/Buzzerapp/Buzzer.img
BK7175 6aa823d
Update Buzzer.info
BK7175 c17dc2c
Update and rename Buzzer.info to metadata.json
BK7175 663d8e5
Rename Buzzerapp.app.js to app.js
BK7175 5a5e185
Update app-icon.js
BK7175 b517f80
Delete apps/Buzzerapp/app.png
BK7175 7e00fb6
Add files via upload
BK7175 a318dbe
Delete apps/Buzzerapp/app.png
BK7175 60c7023
Add files via upload
BK7175 27469ea
Update app-icon.js
BK7175 35e7638
Update app.js
BK7175 2d15af4
Merge branch 'espruino:master' into master
BK7175 a1da174
Merge branch 'espruino:master' into master
BK7175 d663c37
Update ChangeLog
BK7175 8ff9701
Delete apps/1watchface directory
BK7175 a4f912f
Update README.md
BK7175 ab9b5af
Update README.md
BK7175 42fefbd
Update metadata.json
BK7175 e416acc
Delete apps/watchface
BK7175 ea6a5ac
Update README.md
BK7175 2766ffc
Update README.md
BK7175 7aebe85
Create puckjs-code
BK7175 1c94e82
Merge branch 'espruino:master' into master
BK7175 f6a4ef9
Rename puckjs-code to puckjs-code.md
BK7175 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.01: New App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ "id": "Buzzerapp", | ||
"name": "Buzzer APP", | ||
"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} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?