Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c809ee4fdf | ||
|
|
8e67e69602 | ||
|
|
0b508e37b1 | ||
|
|
e1a3aca9f8 | ||
|
|
bbe93ae9a2 | ||
|
|
6fd18b4f4c | ||
|
|
b511537348 | ||
|
|
749ba6b984 | ||
|
|
e571bec213 | ||
|
|
1ad90eda81 | ||
|
|
0c604498d3 | ||
|
|
a8ec408f96 | ||
|
|
40fe1b4616 | ||
|
|
e52da19925 | ||
|
|
d558f70118 | ||
|
|
8fca50e907 | ||
|
|
8c4abe979b |
BIN
docs/static/mb/device/usb-generic.jpg
vendored
BIN
docs/static/mb/device/usb-generic.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 68 KiB |
BIN
docs/static/mb/device/usb-mac.jpg
vendored
BIN
docs/static/mb/device/usb-mac.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 159 KiB |
BIN
docs/static/mb/device/usb-thin.jpg
vendored
BIN
docs/static/mb/device/usb-thin.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 67 KiB |
@@ -4,7 +4,7 @@
|
|||||||
/**
|
/**
|
||||||
* Provides access to basic micro:bit functionality.
|
* Provides access to basic micro:bit functionality.
|
||||||
*/
|
*/
|
||||||
//% color=#0078D7 weight=100
|
//% color=#54C9C9 weight=100
|
||||||
namespace basic {
|
namespace basic {
|
||||||
/**
|
/**
|
||||||
* Sets the color on the build-in LED. Set to 0 to turn off.
|
* Sets the color on the build-in LED. Set to 0 to turn off.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ enum Colors {
|
|||||||
/**
|
/**
|
||||||
* Provides access to basic micro:bit functionality.
|
* Provides access to basic micro:bit functionality.
|
||||||
*/
|
*/
|
||||||
//% color=#0078D7 weight=100
|
//% color=#54C9C9 weight=100
|
||||||
namespace basic {
|
namespace basic {
|
||||||
/**
|
/**
|
||||||
* Converts the color name to a number
|
* Converts the color name to a number
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Runtime and event utilities.
|
* Runtime and event utilities.
|
||||||
*/
|
*/
|
||||||
//% weight=1 color="#333333"
|
//% weight=1 color="#42495F"
|
||||||
//% advanced=true
|
//% advanced=true
|
||||||
namespace control {
|
namespace control {
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ enum class Gesture {
|
|||||||
SixG = MICROBIT_ACCELEROMETER_EVT_6G
|
SixG = MICROBIT_ACCELEROMETER_EVT_6G
|
||||||
};
|
};
|
||||||
|
|
||||||
//% color=300 weight=99
|
//% color=#C90072 weight=99
|
||||||
namespace input {
|
namespace input {
|
||||||
/**
|
/**
|
||||||
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
|
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Events and data from sensors
|
* Events and data from sensors
|
||||||
*/
|
*/
|
||||||
//% color=#B4009E weight=99
|
//% color=#C90072 weight=99
|
||||||
namespace input {
|
namespace input {
|
||||||
/**
|
/**
|
||||||
* Attaches code to run when the screen is facing up.
|
* Attaches code to run when the screen is facing up.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ enum class DisplayMode_ {
|
|||||||
// TODO DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE
|
// TODO DISPLAY_MODE_BLACK_AND_WHITE_LIGHT_SENSE
|
||||||
};
|
};
|
||||||
|
|
||||||
//% color=3 weight=35
|
//% color=#8169E6 weight=35
|
||||||
namespace led {
|
namespace led {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Control of the LED screen.
|
* Control of the LED screen.
|
||||||
*/
|
*/
|
||||||
//% color=#5C2D91 weight=97
|
//% color=#8169E6 weight=97
|
||||||
namespace led {
|
namespace led {
|
||||||
|
|
||||||
// what's the current high value
|
// what's the current high value
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Blocks to control the onboard motors
|
* Blocks to control the onboard motors
|
||||||
*/
|
*/
|
||||||
//% weight=30
|
//% color=#008272 weight=30
|
||||||
namespace motors {
|
namespace motors {
|
||||||
/**
|
/**
|
||||||
* Controls the power sent to a single motor
|
* Controls the power sent to a single motor
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace music {
|
|||||||
*/
|
*/
|
||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone weight=90
|
||||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||||
//% parts="speaker"
|
//% parts="speaker" async
|
||||||
void playTone(int freqency, int ms) {
|
void playTone(int freqency, int ms) {
|
||||||
uBit.soundmotor.Sound_On(freqency);
|
uBit.soundmotor.Sound_On(freqency);
|
||||||
if(ms > 0) uBit.sleep(ms);
|
if(ms > 0) uBit.sleep(ms);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ enum BeatFraction {
|
|||||||
/**
|
/**
|
||||||
* Generation of music tones through pin ``P0``.
|
* Generation of music tones through pin ``P0``.
|
||||||
*/
|
*/
|
||||||
//% color=#D83B01 weight=98
|
//% color=#DF4600 weight=98
|
||||||
namespace music {
|
namespace music {
|
||||||
let beatsPerMinute: number = 120;
|
let beatsPerMinute: number = 120;
|
||||||
|
|
||||||
|
|||||||
10
libs/core/shims.d.ts
vendored
10
libs/core/shims.d.ts
vendored
@@ -126,7 +126,7 @@ declare interface Image {
|
|||||||
/**
|
/**
|
||||||
* Provides access to basic micro:bit functionality.
|
* Provides access to basic micro:bit functionality.
|
||||||
*/
|
*/
|
||||||
//% color=#0078D7 weight=100
|
//% color=#54C9C9 weight=100
|
||||||
declare namespace basic {
|
declare namespace basic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,7 +218,7 @@ declare namespace basic {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//% color=300 weight=99
|
//% color=#C90072 weight=99
|
||||||
declare namespace input {
|
declare namespace input {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -432,7 +432,7 @@ declare namespace control {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//% color=3 weight=35
|
//% color=#8169E6 weight=35
|
||||||
declare namespace led {
|
declare namespace led {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -513,7 +513,7 @@ declare namespace led {
|
|||||||
/**
|
/**
|
||||||
* Blocks to control the onboard motors
|
* Blocks to control the onboard motors
|
||||||
*/
|
*/
|
||||||
//% weight=30
|
//% color=#008272 weight=30
|
||||||
declare namespace motors {
|
declare namespace motors {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -533,7 +533,7 @@ declare namespace music {
|
|||||||
*/
|
*/
|
||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone weight=90
|
||||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||||
//% parts="speaker" shim=music::playTone
|
//% parts="speaker" async shim=music::playTone
|
||||||
function playTone(freqency: number, ms: number): void;
|
function playTone(freqency: number, ms: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-calliope",
|
"name": "pxt-calliope",
|
||||||
"version": "0.5.38",
|
"version": "0.5.45",
|
||||||
"description": "calliope target for PXT",
|
"description": "calliope target for PXT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"typescript": "^1.8.7"
|
"typescript": "^1.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.5.11",
|
"pxt-core": "0.5.23",
|
||||||
"less": "^2.6.0",
|
"less": "^2.6.0",
|
||||||
"semantic-ui-less": "^2.2.4"
|
"semantic-ui-less": "^2.2.4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,8 +219,6 @@
|
|||||||
},
|
},
|
||||||
"appTheme": {
|
"appTheme": {
|
||||||
"accentColor": "#249899",
|
"accentColor": "#249899",
|
||||||
"downloadClass": "orange",
|
|
||||||
"invertedMenu": true,
|
|
||||||
"defaultLocale": "de",
|
"defaultLocale": "de",
|
||||||
"logoUrl": "https://calliope.cc/about",
|
"logoUrl": "https://calliope.cc/about",
|
||||||
"logo": "./static/Calliopeminieditor.svg",
|
"logo": "./static/Calliopeminieditor.svg",
|
||||||
@@ -350,6 +348,11 @@
|
|||||||
"browser": "*",
|
"browser": "*",
|
||||||
"path": "/static/mb/device/usb-windows-sendto.jpg"
|
"path": "/static/mb/device/usb-windows-sendto.jpg"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"invertedMenu": true,
|
||||||
|
"invertedToolbox": true,
|
||||||
|
"blocklyOptions": {
|
||||||
|
"trashcan": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace pxsim {
|
|||||||
radioState: RadioState;
|
radioState: RadioState;
|
||||||
neopixelState: NeoPixelState;
|
neopixelState: NeoPixelState;
|
||||||
rgbLedState: number;
|
rgbLedState: number;
|
||||||
|
speakerState: SpeakerState;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
@@ -59,6 +60,7 @@ namespace pxsim {
|
|||||||
this.builtinParts["lightsensor"] = this.lightSensorState = new LightSensorState();
|
this.builtinParts["lightsensor"] = this.lightSensorState = new LightSensorState();
|
||||||
this.builtinParts["compass"] = this.compassState = new CompassState();
|
this.builtinParts["compass"] = this.compassState = new CompassState();
|
||||||
this.builtinParts["neopixel"] = this.neopixelState = new NeoPixelState();
|
this.builtinParts["neopixel"] = this.neopixelState = new NeoPixelState();
|
||||||
|
this.builtinParts["speaker"] = this.speakerState = new SpeakerState();
|
||||||
|
|
||||||
this.builtinVisuals["buttonpair"] = () => new visuals.ButtonPairView();
|
this.builtinVisuals["buttonpair"] = () => new visuals.ButtonPairView();
|
||||||
this.builtinVisuals["ledmatrix"] = () => new visuals.LedMatrixView();
|
this.builtinVisuals["ledmatrix"] = () => new visuals.LedMatrixView();
|
||||||
|
|||||||
29
sim/state/music.ts
Normal file
29
sim/state/music.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
namespace pxsim {
|
||||||
|
export class SpeakerState {
|
||||||
|
frequency: number;
|
||||||
|
ms: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
namespace pxsim.music {
|
||||||
|
|
||||||
|
export function playTone(frequency: number, ms: number) {
|
||||||
|
const b = board();
|
||||||
|
b.speakerState.frequency = frequency;
|
||||||
|
b.speakerState.ms = ms;
|
||||||
|
|
||||||
|
runtime.queueDisplayUpdate();
|
||||||
|
let cb = getResume();
|
||||||
|
AudioContextManager.tone(frequency, 1);
|
||||||
|
if (ms <= 0) cb();
|
||||||
|
else {
|
||||||
|
setTimeout(() => {
|
||||||
|
AudioContextManager.stop();
|
||||||
|
b.speakerState.frequency = 0;
|
||||||
|
b.speakerState.ms = 0;
|
||||||
|
runtime.queueDisplayUpdate();
|
||||||
|
cb()
|
||||||
|
}, ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1349,6 +1349,7 @@ namespace pxsim.visuals {
|
|||||||
this.updateButtonAB();
|
this.updateButtonAB();
|
||||||
this.updateGestures();
|
this.updateGestures();
|
||||||
this.updateRgbLed();
|
this.updateRgbLed();
|
||||||
|
this.updateSpeaker();
|
||||||
|
|
||||||
if (!runtime || runtime.dead) svg.addClass(this.element, "grayscale");
|
if (!runtime || runtime.dead) svg.addClass(this.element, "grayscale");
|
||||||
else svg.removeClass(this.element, "grayscale");
|
else svg.removeClass(this.element, "grayscale");
|
||||||
@@ -1371,6 +1372,15 @@ namespace pxsim.visuals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateSpeaker() {
|
||||||
|
let state = this.board;
|
||||||
|
if (state.speakerState.frequency) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private updateGestures() {
|
private updateGestures() {
|
||||||
let state = this.board;
|
let state = this.board;
|
||||||
if (state.accelerometerState.useShake && !this.shakeButton) {
|
if (state.accelerometerState.useShake && !this.shakeButton) {
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
/*******************************
|
/*******************************
|
||||||
User Variable Overrides
|
User Variable Overrides
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
|
@invertedBackground: #525A67;
|
||||||
|
@dropdownMenuDistance: 0px;
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
PXT Theme Overrides
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
@mainMenuHeight: 5rem;
|
||||||
|
@mainMenuMinHeight: (@itemVerticalPadding * 2) + 2em;
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
/*******************************
|
/*******************************
|
||||||
Site Overrides
|
Site Overrides
|
||||||
*******************************/
|
*******************************/
|
||||||
|
|
||||||
|
.ui.inverted.input input {
|
||||||
|
background:#424852;
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 0px !important;
|
||||||
|
padding: 0.2em !important;
|
||||||
|
padding-left: 0.6em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rtl .ui.inverted.input input {
|
||||||
|
padding-right: 0.6em !important;
|
||||||
|
}
|
||||||
@@ -7,13 +7,20 @@
|
|||||||
@secondaryColor: #43C9C9;
|
@secondaryColor: #43C9C9;
|
||||||
|
|
||||||
@red:#E81123;
|
@red:#E81123;
|
||||||
@orange:#D78C01;
|
@orange:#DF4600;
|
||||||
@yellow:#EEDA47;
|
@yellow:#F4C918;
|
||||||
@green:#3FC863;
|
@green:#3FC863;
|
||||||
@teal:#008272;
|
@teal:#008272;
|
||||||
@blue:#0078D7;
|
@blue:#54C9C9;
|
||||||
@violet:#CF0071;
|
@violet:#C90072;
|
||||||
@purple:#8073E5;
|
@purple:#8169E6;
|
||||||
@pink:#E2008C;
|
@pink:#E2008C;
|
||||||
@brown:#6B5B4C;
|
@brown:#6B5B4C;
|
||||||
@grey:#515B67;
|
@grey:#42495F;
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
PXT Overrides
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
@backgroundColor: #FDFDFA;
|
||||||
|
@blocklyToolboxColor: #F6F4E6;
|
||||||
@@ -1,2 +1,100 @@
|
|||||||
/* Import all components */
|
/* Import all components */
|
||||||
@import 'semantic';
|
@import 'semantic';
|
||||||
|
@import 'themes/default/globals/site.variables';
|
||||||
|
@import 'themes/pxt/globals/site.variables';
|
||||||
|
@import 'site/globals/site.variables';
|
||||||
|
|
||||||
|
/* Reference import */
|
||||||
|
@import (reference) "semantic.less";
|
||||||
|
|
||||||
|
.openproject {
|
||||||
|
background: #4ECC60 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blocks-menuitem, .javascript-menuitem {
|
||||||
|
background: #738791 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help-dropdown-menuitem, .more-dropdown-menuitem {
|
||||||
|
background: #424955 !important;
|
||||||
|
margin-right:0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play-button {
|
||||||
|
&:extend(.ui all);
|
||||||
|
&:extend(.button all);
|
||||||
|
&:extend(.blue all);
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-button {
|
||||||
|
&:extend(.ui all);
|
||||||
|
&:extend(.button all);
|
||||||
|
&:extend(.yellow all);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.blocklyTreeRow {
|
||||||
|
border-radius:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This removes any padding at the top of the toolbox */
|
||||||
|
.blocklyTreeRoot {
|
||||||
|
padding: 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Blockly Text */
|
||||||
|
.blocklyTreeLabel {
|
||||||
|
font-family: "Gotham SSm A","Gotham SSm B","Montserrat","Lucida Grande","Lucida Sans Unicode","Lucida Sans",Geneva,Verdana,sans-serif !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blocklyTreeLabel {
|
||||||
|
font-size:1rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blocklyFlyoutBackground {
|
||||||
|
fill: @grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blocklyToolboxDiv {
|
||||||
|
/*left:30px !important;*/
|
||||||
|
padding:7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Mobile */
|
||||||
|
@media only screen and (max-width: @largestMobileScreen) {
|
||||||
|
.blocklyTreeLabel {
|
||||||
|
font-size: 0.5rem !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tablet */
|
||||||
|
@media only screen and (min-width: @tabletBreakpoint) and (max-width: @largestTabletScreen) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Small Monitor */
|
||||||
|
@media only screen and (min-width: @computerBreakpoint) and (max-width: @largestSmallMonitor) {
|
||||||
|
.blocklyTreeRow {
|
||||||
|
width: 230px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Large Monitor */
|
||||||
|
@media only screen and (min-width: @largeMonitorBreakpoint) {
|
||||||
|
.blocklyTreeRow {
|
||||||
|
width: 230px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
Menu Bar
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
#menubar {
|
||||||
|
height: 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#fileNameInput {
|
||||||
|
width: 350px;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user