3 activies from curriculum (#194)
* 3 activies from curriculum * fixing style
This commit is contained in:
parent
9f9ce29476
commit
ea46f1cbc7
28
docs/coding.md
Normal file
28
docs/coding.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Coding Activites
|
||||||
|
|
||||||
|
12 computer science activities, with cross-curricular opportunities in design and technology, science, and math.
|
||||||
|
|
||||||
|
* [Download Curriculum Materials](https://education.lego.com/en-us/downloads/mindstorms-ev3)
|
||||||
|
|
||||||
|
## Activites
|
||||||
|
|
||||||
|
```codecard
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "Three Point Turn",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/three-point-turn-1",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Three Point Turn",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/three-point-turn-2",
|
||||||
|
"cardType": "example"
|
||||||
|
}, {
|
||||||
|
"name": "Three Point Turn",
|
||||||
|
"description": "Activity 1",
|
||||||
|
"url":"/coding/three-point-turn-3",
|
||||||
|
"cardType": "example"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
12
docs/coding/three-point-turn-1.md
Normal file
12
docs/coding/three-point-turn-1.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Three Point Turn Activity 1
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(75, 30)
|
||||||
|
loops.pause(1500)
|
||||||
|
motors.largeBC.tank(-30, -75)
|
||||||
|
loops.pause(1000)
|
||||||
|
motors.largeBC.tank(50, 50)
|
||||||
|
loops.pause(3000)
|
||||||
|
})
|
||||||
|
```
|
14
docs/coding/three-point-turn-2.md
Normal file
14
docs/coding/three-point-turn-2.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Three Point Turn Activity 2
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(75, 30)
|
||||||
|
loops.pause(1500)
|
||||||
|
motors.largeBC.tank(-30, -75)
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
|
||||||
|
motors.largeBC.tank(0, 0)
|
||||||
|
loops.pause(1000)
|
||||||
|
motors.largeBC.tank(50, 50)
|
||||||
|
loops.pause(3000)
|
||||||
|
})
|
||||||
|
```
|
15
docs/coding/three-point-turn-3.md
Normal file
15
docs/coding/three-point-turn-3.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Three Point Turn Activity 3
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
|
||||||
|
motors.largeBC.tank(75, 30)
|
||||||
|
loops.pause(1500)
|
||||||
|
motors.largeBC.tank(-30, -75)
|
||||||
|
sensors.ultrasonic4.pauseUntil(UltrasonicSensorEvent.ObjectNear);
|
||||||
|
motors.largeBC.tank(0, 0)
|
||||||
|
music.playSoundEffect(sounds.animalsDogBark1)
|
||||||
|
loops.pause(1000)
|
||||||
|
motors.largeBC.tank(50, 50)
|
||||||
|
loops.pause(3000)
|
||||||
|
})
|
||||||
|
```
|
@ -15,6 +15,7 @@
|
|||||||
"MoveUnit.Degrees|block": "degrees",
|
"MoveUnit.Degrees|block": "degrees",
|
||||||
"MoveUnit.MilliSeconds|block": "milliseconds",
|
"MoveUnit.MilliSeconds|block": "milliseconds",
|
||||||
"MoveUnit.Rotations|block": "rotations",
|
"MoveUnit.Rotations|block": "rotations",
|
||||||
|
"MoveUnit.Seconds|block": "seconds",
|
||||||
"Output.AB|block": "A+B",
|
"Output.AB|block": "A+B",
|
||||||
"Output.AD|block": "A+D",
|
"Output.AD|block": "A+D",
|
||||||
"Output.ALL|block": "All",
|
"Output.ALL|block": "All",
|
||||||
|
@ -30,6 +30,8 @@ enum MoveUnit {
|
|||||||
Rotations,
|
Rotations,
|
||||||
//% block="degrees"
|
//% block="degrees"
|
||||||
Degrees,
|
Degrees,
|
||||||
|
//% block="seconds"
|
||||||
|
Seconds,
|
||||||
//% block="milliseconds"
|
//% block="milliseconds"
|
||||||
MilliSeconds
|
MilliSeconds
|
||||||
}
|
}
|
||||||
@ -246,6 +248,10 @@ namespace motors {
|
|||||||
stepsOrTime = value >> 0;
|
stepsOrTime = value >> 0;
|
||||||
useSteps = true;
|
useSteps = true;
|
||||||
break;
|
break;
|
||||||
|
case MoveUnit.Seconds:
|
||||||
|
stepsOrTime = (value * 1000) >> 0;
|
||||||
|
useSteps = false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
stepsOrTime = value;
|
stepsOrTime = value;
|
||||||
useSteps = false;
|
useSteps = false;
|
||||||
@ -265,7 +271,7 @@ namespace motors {
|
|||||||
readPWM(buf)
|
readPWM(buf)
|
||||||
const flags = buf.getNumber(NumberFormat.UInt8LE, 2);
|
const flags = buf.getNumber(NumberFormat.UInt8LE, 2);
|
||||||
// TODO: FIX with ~ support
|
// TODO: FIX with ~ support
|
||||||
for(let i = 0; i < DAL.NUM_OUTPUTS; ++i) {
|
for (let i = 0; i < DAL.NUM_OUTPUTS; ++i) {
|
||||||
const flag = 1 << i;
|
const flag = 1 << i;
|
||||||
if ((this._port & flag) && (flags & flag))
|
if ((this._port & flag) && (flags & flag))
|
||||||
return false;
|
return false;
|
||||||
@ -554,6 +560,10 @@ namespace motors {
|
|||||||
stepsOrTime = value >> 0;
|
stepsOrTime = value >> 0;
|
||||||
useSteps = true;
|
useSteps = true;
|
||||||
break;
|
break;
|
||||||
|
case MoveUnit.Seconds:
|
||||||
|
stepsOrTime = (value * 1000) >> 0;
|
||||||
|
useSteps = false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
stepsOrTime = value >> 0;
|
stepsOrTime = value >> 0;
|
||||||
useSteps = false;
|
useSteps = false;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"galleries": {
|
"galleries": {
|
||||||
"Maker Activities": "maker"
|
"Maker Activities": "maker",
|
||||||
|
"Coding Activites": "coding"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user