You've already forked Binary-Light-Box
mirror of
https://github.com/MrLyallCSIT/Binary-Light-Box.git
synced 2026-01-18 06:39:34 +00:00
Restore '19/06/2021, 17:22:57 Initialize empty repo'
This commit is contained in:
BIN
.github/makecode/blocks.png
vendored
BIN
.github/makecode/blocks.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 630 KiB |
BIN
.github/makecode/blocksdiff.png
vendored
BIN
.github/makecode/blocksdiff.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 634 KiB |
29
.github/workflows/makecode.yml
vendored
29
.github/workflows/makecode.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: MakeCode
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: npm install
|
||||
run: |
|
||||
npm install -g pxt
|
||||
pxt target microbit
|
||||
- name: build
|
||||
run: |
|
||||
pxt install
|
||||
pxt build --cloud
|
||||
env:
|
||||
CI: true
|
||||
23
.vscode/settings.json
vendored
23
.vscode/settings.json
vendored
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"editor.formatOnType": true,
|
||||
"files.autoSave": "afterDelay",
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/built/**": true,
|
||||
"**/node_modules/**": true,
|
||||
"**/yotta_modules/**": true,
|
||||
"**/yotta_targets": true,
|
||||
"**/pxt_modules/**": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.blocks": "html",
|
||||
"*.jres": "json"
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/built": true,
|
||||
"**/node_modules": true,
|
||||
"**/yotta_modules": true,
|
||||
"**/yotta_targets": true,
|
||||
"**/pxt_modules": true
|
||||
}
|
||||
}
|
||||
30
.vscode/tasks.json
vendored
30
.vscode/tasks.json
vendored
@@ -1,30 +0,0 @@
|
||||
|
||||
// A task runner that calls the MakeCode (PXT) compiler
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [{
|
||||
"label": "pxt deploy",
|
||||
"type": "shell",
|
||||
"command": "pxt deploy --local",
|
||||
"group": "build",
|
||||
"problemMatcher": [ "$tsc" ]
|
||||
}, {
|
||||
"label": "pxt build",
|
||||
"type": "shell",
|
||||
"command": "pxt build --local",
|
||||
"group": "build",
|
||||
"problemMatcher": [ "$tsc" ]
|
||||
}, {
|
||||
"label": "pxt install",
|
||||
"type": "shell",
|
||||
"command": "pxt install",
|
||||
"group": "build",
|
||||
"problemMatcher": [ "$tsc" ]
|
||||
}, {
|
||||
"label": "pxt clean",
|
||||
"type": "shell",
|
||||
"command": "pxt clean",
|
||||
"group": "test",
|
||||
"problemMatcher": [ "$tsc" ]
|
||||
}]
|
||||
}
|
||||
2
Gemfile
2
Gemfile
@@ -1,2 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
gem 'github-pages', group: :jekyll_plugins
|
||||
21
LICENSE
21
LICENSE
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Alexander Davis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
10
Makefile
10
Makefile
@@ -1,10 +0,0 @@
|
||||
all: deploy
|
||||
|
||||
build:
|
||||
pxt build
|
||||
|
||||
deploy:
|
||||
pxt deploy
|
||||
|
||||
test:
|
||||
pxt test
|
||||
31
README.md
31
README.md
@@ -1,31 +0,0 @@
|
||||
|
||||
> Open this page at [https://alexanderedavis.github.io/Binary-Light-Box/](https://alexanderedavis.github.io/Binary-Light-Box/)
|
||||
|
||||
## Use as Extension
|
||||
|
||||
This repository can be added as an **extension** in MakeCode.
|
||||
|
||||
* open [https://makecode.microbit.org/](https://makecode.microbit.org/)
|
||||
* click on **New Project**
|
||||
* click on **Extensions** under the gearwheel menu
|
||||
* search for **https://github.com/alexanderedavis/binary-light-box** and import
|
||||
|
||||
## Edit this project 
|
||||
|
||||
To edit this repository in MakeCode.
|
||||
|
||||
* open [https://makecode.microbit.org/](https://makecode.microbit.org/)
|
||||
* click on **Import** then click on **Import URL**
|
||||
* paste **https://github.com/alexanderedavis/binary-light-box** and click import
|
||||
|
||||
## Blocks preview
|
||||
|
||||
This image shows the blocks code from the last commit in master.
|
||||
This image may take a few minutes to refresh.
|
||||
|
||||

|
||||
|
||||
#### Metadata (used for search, rendering)
|
||||
|
||||
* for PXT/microbit
|
||||
<script src="https://makecode.com/gh-pages-embed.js"></script><script>makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");</script>
|
||||
@@ -1,8 +0,0 @@
|
||||
makecode:
|
||||
target: microbit
|
||||
platform: microbit
|
||||
home_url: https://makecode.microbit.org/
|
||||
theme: jekyll-theme-slate
|
||||
include:
|
||||
- assets
|
||||
- README.md
|
||||
File diff suppressed because one or more lines are too long
94
main.py
94
main.py
@@ -1,94 +0,0 @@
|
||||
function updateNumber () {
|
||||
Denary = 0
|
||||
for (let item = 0; item <= columns.length - 1; item++) {
|
||||
if (columns[item]) {
|
||||
Denary += columnValues[item]
|
||||
}
|
||||
}
|
||||
updateDisplay(Denary)
|
||||
}
|
||||
function updateColumn () {
|
||||
for (let item = 0; item <= columns.length - 1; item++) {
|
||||
updateFlag(item, sensePins[item])
|
||||
}
|
||||
}
|
||||
function switchSensors () {
|
||||
if (pins.digitalReadPin(DigitalPin.P1) == 1) {
|
||||
sensePins[0] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P1) == 0) {
|
||||
sensePins[0] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P2) == 1) {
|
||||
sensePins[1] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P2) == 0) {
|
||||
sensePins[1] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P3) == 1) {
|
||||
sensePins[2] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P3) == 0) {
|
||||
sensePins[2] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P4) == 1) {
|
||||
sensePins[3] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P4) == 0) {
|
||||
sensePins[3] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P6) == 1) {
|
||||
sensePins[4] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P6) == 0) {
|
||||
sensePins[4] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P7) == 1) {
|
||||
sensePins[5] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P7) == 0) {
|
||||
sensePins[5] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P8) == 1) {
|
||||
sensePins[6] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P8) == 0) {
|
||||
sensePins[6] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P9) == 1) {
|
||||
sensePins[7] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P9) == 0) {
|
||||
sensePins[7] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P10) == 1) {
|
||||
sensePins[8] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P10) == 0) {
|
||||
sensePins[8] = false
|
||||
}
|
||||
}
|
||||
function updateFlag (column: number, flag: boolean) {
|
||||
if (flag) {
|
||||
columns[column] = true
|
||||
} else if (!(flag)) {
|
||||
columns[column] = false
|
||||
}
|
||||
}
|
||||
function updateDisplay (number: number) {
|
||||
serial.writeString("/")
|
||||
serial.writeNumber(number)
|
||||
}
|
||||
let Denary = 0
|
||||
let columnValues: number[] = []
|
||||
let columns: boolean[] = []
|
||||
let sensePins: boolean[] = []
|
||||
serial.redirect(
|
||||
SerialPin.P0,
|
||||
SerialPin.P16,
|
||||
BaudRate.BaudRate9600
|
||||
)
|
||||
sensePins = [false, false, false, false, false, false, false, false, false]
|
||||
columns = [false, false, false, false, false, false, false, false, false]
|
||||
columnValues = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
Denary = 0
|
||||
updateDisplay(Denary)
|
||||
let ready = true
|
||||
basic.forever(function () {
|
||||
if (ready) {
|
||||
switchSensors()
|
||||
updateColumn()
|
||||
updateNumber()
|
||||
}
|
||||
})
|
||||
94
main.ts
94
main.ts
@@ -1,94 +0,0 @@
|
||||
function updateNumber () {
|
||||
Denary = 0
|
||||
for (let item = 0; item <= columns.length - 1; item++) {
|
||||
if (columns[item]) {
|
||||
Denary += columnValues[item]
|
||||
}
|
||||
}
|
||||
updateDisplay(Denary)
|
||||
}
|
||||
function updateColumn () {
|
||||
for (let item2 = 0; item2 <= columns.length - 1; item2++) {
|
||||
updateFlag(item2, sensePins[item2])
|
||||
}
|
||||
}
|
||||
function switchSensors () {
|
||||
if (pins.digitalReadPin(DigitalPin.P1) == 1) {
|
||||
sensePins[0] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P1) == 0) {
|
||||
sensePins[0] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P2) == 1) {
|
||||
sensePins[1] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P2) == 0) {
|
||||
sensePins[1] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P3) == 1) {
|
||||
sensePins[2] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P3) == 0) {
|
||||
sensePins[2] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P4) == 1) {
|
||||
sensePins[3] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P4) == 0) {
|
||||
sensePins[3] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P6) == 1) {
|
||||
sensePins[4] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P6) == 0) {
|
||||
sensePins[4] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P7) == 1) {
|
||||
sensePins[5] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P7) == 0) {
|
||||
sensePins[5] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P8) == 1) {
|
||||
sensePins[6] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P8) == 0) {
|
||||
sensePins[6] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P9) == 1) {
|
||||
sensePins[7] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P9) == 0) {
|
||||
sensePins[7] = false
|
||||
}
|
||||
if (pins.digitalReadPin(DigitalPin.P10) == 1) {
|
||||
sensePins[8] = true
|
||||
} else if (pins.digitalReadPin(DigitalPin.P10) == 0) {
|
||||
sensePins[8] = false
|
||||
}
|
||||
}
|
||||
function updateFlag (column: number, flag: boolean) {
|
||||
if (flag) {
|
||||
columns[column] = true
|
||||
} else if (!(flag)) {
|
||||
columns[column] = false
|
||||
}
|
||||
}
|
||||
function updateDisplay (number: number) {
|
||||
serial.writeString("/")
|
||||
serial.writeNumber(number)
|
||||
}
|
||||
let Denary = 0
|
||||
let columnValues: number[] = []
|
||||
let columns: boolean[] = []
|
||||
let sensePins: boolean[] = []
|
||||
serial.redirect(
|
||||
SerialPin.P0,
|
||||
SerialPin.P16,
|
||||
BaudRate.BaudRate9600
|
||||
)
|
||||
sensePins = [false, false, false, false, false, false, false, false, false]
|
||||
columns = [false, false, false, false, false, false, false, false, false]
|
||||
columnValues = [1, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||
Denary = 0
|
||||
updateDisplay(Denary)
|
||||
let ready = true
|
||||
basic.forever(function () {
|
||||
if (ready) {
|
||||
switchSensors()
|
||||
updateColumn()
|
||||
updateNumber()
|
||||
}
|
||||
})
|
||||
20
pxt.json
20
pxt.json
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"name": "Binary Box",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"core": "*",
|
||||
"microphone": "*"
|
||||
},
|
||||
"files": [
|
||||
"main.blocks",
|
||||
"main.ts",
|
||||
"README.md",
|
||||
"main.py"
|
||||
],
|
||||
"testFiles": [],
|
||||
"supportedTargets": [
|
||||
"microbit"
|
||||
],
|
||||
"preferredEditor": "blocksprj"
|
||||
}
|
||||
1
test.ts
1
test.ts
@@ -1 +0,0 @@
|
||||
// tests go here; this will not be compiled when this package is used as an extension.
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"noImplicitAny": true,
|
||||
"outDir": "built",
|
||||
"rootDir": "."
|
||||
},
|
||||
"exclude": ["pxt_modules/**/*test.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user