Skip to content

Commit

Permalink
Final update; v1 release 🥳 !
Browse files Browse the repository at this point in the history
  • Loading branch information
fredster33 committed Nov 10, 2021
1 parent 494d621 commit 0682f24
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 36 deletions.
Binary file modified .github/makecode/blocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .github/makecode/blocksdiff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 2 additions & 9 deletions main.blocks

Large diffs are not rendered by default.

37 changes: 11 additions & 26 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
/**
* radio send string HELP
*
* replace with "bluetooth uart write string e:HELP"
*/
function simpleCompass () {
if (Math.constrain(input.compassHeading(), 315, 360) == input.compassHeading()) {
basic.showString("N")
Expand All @@ -23,26 +18,21 @@ input.onButtonPressed(Button.A, function () {
menu = 0
}
})
/**
* on radio recieved recievedstring
*
* if recievedstring
*
* else if recievedstring
*/
bluetooth.onUartDataReceived(serial.delimiters(Delimiters.NewLine), function () {
if (bluetooth.uartReadUntil(serial.delimiters(Delimiters.NewLine)) == "e:HELP") {
radio.onReceivedString(function (receivedString) {
if (receivedString == "HELP") {
recievedMessage = 1
basic.showString("HELP")
} else if (bluetooth.uartReadUntil(serial.delimiters(Delimiters.NewLine)) == "e:FALL") {
recievedMessage = 0
} else if (receivedString == "FALL") {
recievedMessage = 1
basic.showString("FALL")
recievedMessage = 0
}
})
input.onButtonPressed(Button.B, function () {
if (askedForHelp == 1) {
sentHelp = 1
bluetooth.uartWriteString("e:HELP")
radio.sendString("HELP")
basic.showIcon(IconNames.Yes)
}
})
Expand All @@ -67,24 +57,19 @@ function detailedCompass () {
basic.showString("NW")
}
}
/**
* radio set group radioChannel
*
* (just delete, replace with start bluetooth)
*/
let distance = 0
let recievedMessage = 0
let sentHelp = 0
let askedForHelp = 0
let menu = 0
let timeFormat = 24
let radioChannel = 33
menu = 0
askedForHelp = 0
sentHelp = 0
recievedMessage = 0
bluetooth.startUartService()
bluetooth.setTransmitPower(7)
radio.setGroup(33)
radio.setTransmitPower(7)
radio.setTransmitSerialNumber(false)
if (timeFormat == 12) {
timeanddate.setTime(5, 24, 0, timeanddate.MornNight.AM)
} else {
Expand All @@ -97,8 +82,8 @@ loops.everyInterval(500, function () {
// anita is a genius
// ask anita if I forgot
led.plotBarGraph(
101 - distance,
100
201 - distance,
200
)
} else if (menu == 1) {
basic.clearScreen()
Expand Down
2 changes: 1 addition & 1 deletion pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"microphone": "*",
"microbit-pxt-timeanddate": "github:bsiever/microbit-pxt-timeanddate#v2.0.24",
"pxt-sonar": "github:microsoft/pxt-sonar#v0.0.5",
"bluetooth": "*"
"radio": "*"
},
"files": [
"main.blocks",
Expand Down

2 comments on commit 0682f24

@fredster33
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fredster33
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's changed in this release:

-This is the first release! I didn't write patch notes for the previous commits, but here's specifically what was changed in this commit:
-Reverted radio to bluetooth. Bluetooth just wasn't working 🤷 Customs settings will be added in a later release.
-Cleaned up code in general!
-Increased distance "magic number" to 2 meters, as generally the sensor is good enough for 2m.

Goals for version 2:

-Custom Bluetooth settings, updated through an app
-After the Microbit is updated to Version 2, a music function can be added. Version 2 is also faster!

Please sign in to comment.