The brief:
- to create containers for micro:bits to communicate and connect to each other physically
- only using materials from a supermarket
- keep it cheap
- Design Brief
- Block Design
- Connections
- Gates
- And Gates
- Or Gates
- Not Gates
- Connections
- The Combined And and Not Gate
- Team
We needed specific blocks for each component involved in the design. We need a modular design for each block (i.e. two inputs and one output box). This will ensure that each block is designed specifically for its purpose and makes it more intuitive for the end user.
To simulate logic gates (Or Gate
/And Gate
/Not Gate
etc.), we need inputs to represent the binary inputs. The inputs only require one output terminal, also communicating in binary, using a method called digital read. To connect the blocks we need a common ground terminal. Therefore, the input blocks require a ground terminal because they each will only have one side that connects to another component.
Most of the gates require two inputs to give a separate single output, but it is more convenient to supply two outputs, and two ground terminals. The gates will have a total of 8 terminals, however, the Not Gates will have a total of 4 terminals: an input, an output, and two ground terminals.
To allow the user to see the LED matrix, we cut out a slice from the net to provide a transparent area. There is also a magnet behind each terminal to ensure a strong and easy connection. This will also cause the wrong sides to repel, making it more intuitive for the end user.
Using magnetic tabs, tinfoil and sellotape, we are able to create physical connections that conduct electricity across the micro:bits. Although using wire would have been safer, as it is more insulated than tin foil, the latter is cheaper and more easily accessed, therefore it is more fitting to the brief of the design.
In total, there are three gates: AND, OR and NOT. The AND gate takes in two inputs, either a 0 or a 1, and the condition is that they both have to equal 1 in order to output a 1. The OR gate ensures that if either input is a 1, the output will be 1. The NOT gate includes only one input. If this is a 1, the output will be 0 and vice versa. Truth table for the AND gate:
Input 1 | Input 2 | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Truth table for the OR gate:
Input 1 | Input 2 | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Truth table for the NOT gate:
Input 1 | Output |
---|---|
0 | 0 |
1 | 1 |
Code for the Inputs:
let qrt = 0
input.onButtonPressed(Button.AB, () => {
if (qrt == 100) {
qrt = 0
} else {
qrt = 100
}
})
basic.forever(() => {
basic.clearScreen()
while (qrt == 0) {
if (input.buttonIsPressed(Button.A)) {
pins.digitalWritePin(DigitalPin.P0, 1)
basic.showLeds(`
. . # . .
. # # . .
. . # . .
. . # . .
. # # # .
`)
} else if (input.buttonIsPressed(Button.B)) {
pins.digitalWritePin(DigitalPin.P0, 0)
basic.showLeds(`
. . # . .
. # . # .
. # . # .
. # . # .
. . # . .
`)
}
}
})
Code for the And Gates:
let qrt = 10
input.onButtonPressed(Button.AB, () => {
if (qrt == 10) {
qrt = 0
}
else {
qrt = 10
}
})
basic.forever(() => {
basic.clearScreen()
while (qrt == 10) {
if (pins.digitalReadPin(DigitalPin.P1) == 1 && pins.digitalReadPin(DigitalPin.P2) == 1) {
pins.digitalWritePin(DigitalPin.P0, 1)
basic.showLeds(`
. . # . .
. # # . .
. . # . .
. . # . .
. # # # .
`)
} else {
pins.digitalWritePin(DigitalPin.P0, 0)
basic.showLeds(`
. . # . .
. # . # .
. # . # .
. # . # .
. . # . .
`)
}
}
})
The code for the Or Gates
let qrt = 0
input.onButtonPressed(Button.AB, () => {
if (qrt == 100) {
qrt = 0
} else {
qrt = 100
}
})
basic.forever(() => {
basic.clearScreen()
while (qrt == 100) {
if (pins.digitalReadPin(DigitalPin.P1) == 0 && pins.digitalReadPin(DigitalPin.P2) == 0) {
pins.digitalWritePin(DigitalPin.P0, 0)
basic.showLeds(`
. . # . .
. # . # .
. # . # .
. # . # .
. . # . .
`)
} else {
pins.digitalWritePin(DigitalPin.P0, 1)
basic.showLeds(`
. . # . .
. # # . .
. . # . .
. . # . .
. # # # .
`)
}
}
})
The Code For the Not Gates:
let qrt = 0
input.onButtonPressed(Button.AB, () => {
if (qrt == 10) {
qrt = 0
} else {
qrt = 10
}
})
qrt = 10
basic.forever(() => {
basic.clearScreen()
while (qrt == 10) {
if (pins.digitalReadPin(DigitalPin.P1) == 0) {
pins.digitalWritePin(DigitalPin.P0, 1)
basic.showLeds(`
. . # . .
. # # . .
. . # . .
. . # . .
. # # # .
`)
} else {
pins.digitalWritePin(DigitalPin.P0, 0)
basic.showLeds(`
. . # . .
. # . # .
. # . # .
. # . # .
. . # . .
`)
}
}
})
Team:
- Halle Gordon-Jeary: Power Point And Script Writer
- Orla Brimacombe: Jokes Person innit, Hypeman/Woman, Moral Supporter, Potato Searcher, SpellCheck and Editor.
- Asma Mansur: Encapsulation Designer
- Jeevan Dominguez: Project Manager, And Circuit Designer
- Almaz Ahmad : Lead Programmer