updated telegraph project

This commit is contained in:
Peli de Halleux 2016-10-03 22:32:27 -07:00
parent a30ca46fef
commit d69a82d167
3 changed files with 104 additions and 88 deletions

View File

@ -1,75 +1,25 @@
# telegraph activity
Build a telgraph.
# micro:bit telegraph
![](/static/mb/lessons/telegraph-0.png)
In this project, you will build your telegraph between micro:bits. Project duration: 15 minutes.
### ~avatar
Build a telegraph between two micro:bits to communicate with your friends!
### ~
## Duration: ~30 minutes
## Materials
* micro:bit, battery holder and 2 AAA batteries
* Crocodile clips
## Steps
## Activities
### Step 1
![](/static/mb/lessons/banana-keyboard-1.png)
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin on the micro:bit.
### Step 2
![](/static/mb/lessons/ornament-chain-2.png)
Using the 2nd crocodile clip, connect the end of the crocodile clip onto the 3V pin on the micro:bit.
### Step 3
![](/static/mb/lessons/ornament-chain-3.png)
Using the 3rd crocodile clip, connect the end of the crocodile clip onto pin 1 of the micro:bit.
### Step 4
![](/static/mb/lessons/ornament-chain-4.png)
Using the 4th crocodile clip, connect the end of the crocodile clip onto pin 2 of the micro:bit.
### Step 5
![](/static/mb/lessons/ornament-chain-5.png)
Using the 1st crocodile clip, connect the unattached end of the crocodile clip onto the GND on the 2nd micro:bit.
### Step 6
![](/static/mb/lessons/ornament-chain-6.png)
Using the 2nd crocodile clip, connect the unattached end of the crocodile clip onto the 3V pin on the 2nd micro:bit.
### Step 7
![](/static/mb/lessons/ornament-chain-7.png)
Using the 3rd crocodile clip, connect the unattached end of the crocodile clip onto pin 2 of the 2nd micro:bit.
### Step 8
![](/static/mb/lessons/ornament-chain-8.png)
Using the 4th crocodile clip, connect the unattached end of the crocodile clip onto pin 1 of the 2nd micro:bit
### Step 9
![](/static/mb/lessons/telegraph-0.png)
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/projects/telegraph-challenges)!
* [Making the circuit](/projects/telegraph/making)
* [Manual telegraph](/projects/telegraph/manual-telegraph)
### ~button /projects/telegraph/making
Let's get started!
### ~

View File

@ -0,0 +1,75 @@
# telegraph - making
### ~avatar
Let's build a telegraph between two micro:bits.
### ~
![](/static/mb/lessons/telegraph-0.png)
## Materials
* micro:bit, battery holder and 2 AAA batteries
* Crocodile clips
## Steps
### Step 1
![](/static/mb/lessons/banana-keyboard-1.png)
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin on the micro:bit.
### Step 2
![](/static/mb/lessons/ornament-chain-2.png)
Using the 2nd crocodile clip, connect the end of the crocodile clip onto the 3V pin on the micro:bit.
### Step 3
![](/static/mb/lessons/ornament-chain-3.png)
Using the 3rd crocodile clip, connect the end of the crocodile clip onto pin 1 of the micro:bit.
### Step 4
![](/static/mb/lessons/ornament-chain-4.png)
Using the 4th crocodile clip, connect the end of the crocodile clip onto pin 2 of the micro:bit.
### Step 5
![](/static/mb/lessons/ornament-chain-5.png)
Using the 1st crocodile clip, connect the unattached end of the crocodile clip onto the GND on the 2nd micro:bit.
### Step 6
![](/static/mb/lessons/ornament-chain-6.png)
Using the 2nd crocodile clip, connect the unattached end of the crocodile clip onto the 3V pin on the 2nd micro:bit.
### Step 7
![](/static/mb/lessons/ornament-chain-7.png)
Using the 3rd crocodile clip, connect the unattached end of the crocodile clip onto pin 2 of the 2nd micro:bit.
### Step 8
![](/static/mb/lessons/ornament-chain-8.png)
Using the 4th crocodile clip, connect the unattached end of the crocodile clip onto pin 1 of the 2nd micro:bit
### Step 9
![](/static/mb/lessons/telegraph-0.png)
### ~button /projects/telegraph/manual-telegraph
NEXT: manual telegraph
### ~

View File

@ -1,18 +1,10 @@
# telegraph activity
# telegraph - manual telegraph
Build a telegraph.
# micro:bit telegraph
Have you ever tried to communicate through a telegraph? Let's try coding a "Telegraph" on two BBC micro:bits !
Complete the following [tutorial](/projects/telegraph), your hack should look like this:
![](/static/mb/lessons/telegraph-0.png)
Let's build the code that will send a impulse while the user presses ``A``.
### Step 1
We now need to digitally write to the specified pin (P0) as digital. Let's start by adding the code in the pin drawer that includes 'digital write (0,1) to pin P0'.. Then insert 1 for digital write.
We now need to digitally write to pin ``P0`` as **high** (1).
```blocks
pins.digitalWritePin(DigitalPin.P0, 1)
@ -21,7 +13,8 @@ pins.digitalWritePin(DigitalPin.P0, 1)
### Step 2
We want to add a block to turn on an LED in the middle area of the LED display using plot x, y. So insert the appropriate LED plot x, y.
We want to add a block to turn on an LED in the middle area of the LED display using plot x, y.
So insert the appropriate LED plot x, y.
```blocks
pins.digitalWritePin(DigitalPin.P0, 1)
@ -31,7 +24,8 @@ led.plot(2, 2)
### Step 3
We want to insert a condition that tells us when to turn on the LED. So insert the if block under logic drawer. Then add a condition that occurs if we do not turn on a LED with plot x, y. We also should plot an LED on the display if button A is pressed. Your code should appear as follows:
We want to insert a condition that tells us when to turn on the LED. So insert the if block under logic drawer.
Then add a condition that occurs if we do not turn on a LED with plot x, y. We also should plot an LED on the display if button A is pressed. Your code should appear as follows:
```blocks
if (input.buttonIsPressed(Button.A)) {
@ -45,7 +39,7 @@ if (input.buttonIsPressed(Button.A)) {
### Step 4
We want to write code if button A is NOT pressed. It is important to say that digital write is not on. We also want to turn off all LED lights on the LED screen
We want to write code if button A is NOT pressed. It is important to say that digital write is not on. We also want to turn off all the LED light.
```blocks
if (input.buttonIsPressed(Button.A)) {
@ -53,7 +47,7 @@ if (input.buttonIsPressed(Button.A)) {
led.plot(2, 2)
} else {
pins.digitalWritePin(DigitalPin.P0, 0)
basic.clearScreen()
led.unplot(2, 2)
}
```
@ -64,27 +58,24 @@ Let's add a forever loop so this code runs in the background forever. Modify you
```blocks
basic.forever(() => {
if (input.buttonIsPressed(Button.A)) {
pins.digitalWritePin(DigitalPin.P0, 1)
led.plot(2, 2)
} else {
pins.digitalWritePin(DigitalPin.P0, 0)
basic.clearScreen()
}
})
pins.digitalWritePin(DigitalPin.P0, 1)
led.plot(2, 2)
} else {
pins.digitalWritePin(DigitalPin.P0, 0)
led.unplot(2, 2)
})
```
### Step 6
We now need to digitally read to the specified pin (P1) as digital. Let's start by going to the pin drawer and adding digital read pin (0,1) and changing the pin to P1. Now we need to create a condition for digital read pin (0,1). So we go to the logic drawer and select the comparison operator. Then we want to set the comparison operator to 1 to turn on digital read on pin 1. We want to insert a condition that tells us if button A is pressed and we should turn on digital read on pin 1. So insert the if block under logic drawer. Then add a condition that occurs if digital read on P1 is on. Then we want to plot x, y at the x, y coordinates of 2,2. we also want to say that if digital read pin P1 is not on, we want to turn off all LED lights on the screen. Your code should appear as follows:
```blocks
if (pins.digitalReadPin(DigitalPin.P1) == 1) {
led.plot(2, 2);
led.plot(4, 4);
}
else {
basic.clearScreen();
led.unplot(4, 4);
}
basic.forever(() => {
if (input.buttonIsPressed(Button.A)) {