microsoft / pxt-microbit Goto Github PK
View Code? Open in Web Editor NEWA Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
Home Page: https://makecode.microbit.org
License: Other
A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
Home Page: https://makecode.microbit.org
License: Other
1 go to KSF, JS
input.onLogoUp(() => {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
3 the page does not render in Docs
http://localhost:3232/lessons/magic-logo/activity
4
what do you want to do with the teaching of collections?
is showAnimation a supported API?
see this example...
http://localhost:3232/lessons/rotation-animation/quiz
if not, we should think of a global find/replace for the replacement API
0 go to my docs. page not rendering the blocks
http://localhost:3232/lessons/night-light/quiz-answers
1 go to KSF, JS
2 enter this code
led.setBrightness(128)
led.plotAll()
led.setBrightness(255)
led.plotAll()
there is no difference in brightness
unable to import a script
documentation - music blocks not appearing
1 open KSF, click JS
2 enter this code
let light = 0;
input.onButtonPressed(Button.A, () => {
music.rest(music.beat(BeatFraction.Sixteenth));
light = input.lightLevel();
if (light < 25) {
music.ringTone(music.noteFrequency(Note.C));
}
else {
music.ringTone(music.noteFrequency(Note.A));
}
});
3 music blocks do not appear
code was fixed 5 minutes ago, the blocks are not rendering for a second time (after fixing the code - they appeared to be fixed and visibly rendering 5 minutes ago on localhost)
http://localhost:3232/lessons/prank-wifi/activity
basic.showString("Check Wifi", 150)
basic.forever(() => {
let xAccel2 = Math.abs(input.acceleration(Dimension.X))
let yAccel2 = Math.abs(input.acceleration(Dimension.Y))
let zAccel2 = Math.abs(input.acceleration(Dimension.Z))
let sum2 = xAccel2 + yAccel2 + zAccel2
if (sum2 < 1200) {
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. # # . .
# # # . .
`)
} else if (sum2 >= 1400 && sum2 < 1680) {
basic.showLeds(`
. . . . .
. . . # .
. . # # .
. # # # .
# # # # .
`)
}
else if (sum2 >= 1680) {
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
# . . . .
`)
}
if (sum2 >= 1200 && sum2 < 1400) {
basic.showLeds(`
. . . . #
. . . # #
. . # # #
. # # # #
# # # # #
`)
}
})
When you set variable in blocks, then click show Code... the variable is automatically set as null
let item = null;
item = 0;
1 go to any page with images
2 example
http://localhost:3232/lessons/lucky-7/quiz
3 pictures appear massive
1 open KSF, click blocks
2 enter program using music / light level
let light = 0;
input.onButtonPressed(Button.A, () => {
music.rest(music.beat(BeatFraction.Sixteenth));
light = input.lightLevel();
if (light < 25) {
music.ringTone(music.noteFrequency(Note.C));
}
else {
music.ringTone(music.noteFrequency(Note.A));
}
});
3 expect sound to play based on acceleration 'y' in simulator
1 open docs
http://localhost:3232/lessons/hero/activity
2 search for this blocks
3 this block appears missing
1 go to codemicrobit.com, open JS
2 enter this code
let rotating = true;
input.onButtonPressed(Button.A, () => {
serial.writeLine("hello")
rotating = false
})
while (rotating) {
serial.writeLine("loop")
basic.showLeds(`
# . . . .
. # . . .
. . # . .
. . . # .
. . . . #
`)
basic.showLeds(`
. . # . .
. . # . .
. . # . .
. . # . .
. . # . .
`)
basic.showLeds(`
. . . . #
. . . # .
. . # . .
. # . . .
# . . . .
`)
basic.showLeds(`
. . . . .
. . . . .
# # # # #
. . . . .
. . . . .
`)
}
3 copy this code into docs...cannot render blocks/JS
Can we have a global change in docs?
basic.plotImage
basic.showLeds
the code works in the simulator, but not rendering
open KSF, enter this in JS
let basketX = 2
let eggX = 2
let eggY = 0
basic.forever(() => {
led.unplot(basketX, 4)
led.unplot(eggX, eggY)
eggY = eggY + 1
led.plot(eggX, eggY)
basic.pause(300)
let accX = input.acceleration(Dimension.X)
basketX = 2 + Math.min(2, Math.max(-2, accX / 200))
led.plot(basketX, 4)
if (eggY > 4) {
eggY = -1
eggX = Math.random(5)
}
basic.pause(300)
})
here is the lesson
you cannot rename variables in Blocks
Why is serial only present in an isolated example of on radio received?
Serial is present on data received in this example
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X))
})
radio.onDataReceived(() => {
led.plotBarGraph(radio.receiveNumber(), 1023)
})
Serial is not present on data received in this example. Why is this the case?
let jumps = 0
basic.forever(() => {
let acc = input.acceleration(Dimension.Y)
if (acc > 2000) {
jumps = jumps + 1;
radio.sendNumber(jumps)
basic.showLeds(`
. . . . .
. # . # .
. . # . .
# . . . #
. # # # .
`)
basic.clearScreen()
}
})
input.onButtonPressed(Button.A, () => {
basic.showNumber(jumps)
})
input.onButtonPressed(Button.AB, () => {
let jumps = 0
basic.showNumber(jumps)
})
radio.onDataReceived(() => {
basic.showNumber(radio.receiveNumber())
led.stopAnimation()
})
let jumps = 0
basic.forever(() => {
let acc = input.acceleration(Dimension.Y)
if (acc > 2000) {
jumps = jumps + 1;
radio.sendNumber(jumps)
basic.showLeds(`
. . . . .
. # . # .
. . # . .
# . . . #
. # # # .
`)
basic.clearScreen()
}
})
input.onButtonPressed(Button.A, () => {
basic.showNumber(jumps)
})
input.onButtonPressed(Button.AB, () => {
let jumps = 0
basic.showNumber(jumps)
})
radio.onDataReceived(() => {
basic.showNumber(radio.receiveNumber())
led.stopAnimation()
})
Run / Compile does not work
1 open Edge
2 codemicrobit.com/lessons
3 (example) https://codemicrobit.com/lessons/charting/activity
4 i would expect the program this program to run
in the simulator
2 usage of showAnimation
http://localhost:3232/lessons/smiley/activity
when errors in code, students don't know an error exists.
Go to script...
https://codemicrobit.com/fkayhbkytt
Go to Project Settings - YouTube video inserted
https://youtu.be/TCAlAKvMx2M?list=PLE8XLCpSej07SC0CKPLsfhKNVelPXjBS4
The video is not noticeable. Does this feature work?
open vs code.
1 global find <br / > tags
2 global replace with amper sign
3 allow spacing for quiz and quiz answers (fix break tags)
expectation: You could receive data from a single micro:bit
2 enter this code
basic.forever(() => {
led.plotBarGraph(input.acceleration(Dimension.X), 1023);
});
3 it would be ideal to receive Excel data from a single micro:bit using acceleration, it doesn not appear possible.
is this intentional ?
1 open JS
let hero = game.createSprite(2, 2);
let food = game.createSprite(4, 4);
let ghost = game.createSprite(0, 0);
ghost.change(LedSpriteProperty.Blink, 100);
let hero = game.createSprite(2, 2)
let food = game.createSprite(4, 4)
let ghost = game.createSprite(0, 0)
ghost.change(LedSpriteProperty.Blink, 100)
WIN10 APP - Open Project (Naming Conventions)
go to a lesson... ie.
https://codemicrobit.com/lessons/zoomer/challenges
Download .hex file
Open Program in WIN 10.
a. none of the naming of the scripts appear accurate
b. the programs are empty
convert input light level to JS - automatic set var to 0
1 why do you need to store light level as 0?
2 enter this code in blocks
let light = input.lightLevel();
3 then press show in code
4
this is the code that appears
let light = 0;
light = input.lightLevel();
2 i would expect when converting from blocks to JS, the code would appear like this
let light = input.lightLevel();
1 open any lesson plan
2 for example
http://localhost:3232/lessons/beautiful-image
3 blocks don't render
Beginner
Maker
1 go to ksf, click js
2 enter this code
basic.forever(() => {
radio.sendNumber(input.acceleration(Dimension.X))
})
radio.onDataReceived(() => {
led.plotBarGraph(radio.receiveNumber(), 1023)
})
3 view the lesson
2 or click on this link
music blocks - blocks to JS
1 in reference to the light beatbox lesson
http://localhost:3232/lessons/light-beatbox/activity
2 enter this code with blocks
let light = 0;
input.onButtonPressed(Button.A, () => {
music.rest(music.beat(BeatFraction.Sixteenth));
light = input.lightLevel();
if (light < 25) {
music.ringTone(music.noteFrequency(Note.C));
}
else {
music.ringTone(music.noteFrequency(Note.A));
}
});
3 press convert.
4 i would expect the code to be equal to the following when using ringTone using JS without Blocks
input.onButtonPressed(Button.A, () => {
music.rest(BeatFraction.Sixteenth)
let light = input.lightLevel()
if (light < 25) {
music.ringTone(Note.C)
}
else {
music.ringTone(Note.C);
}
})
4 however, the conversion is not 1:1. Am i missing something when using music with JS vs using music with blocks ?
importing not working
basic.forever(() => {
basic.showString("Hello!")
})
We should reconsider -- or -- deprecate the difference of semantics between blocks and js.
the code is working in microbit.co.uk, not in codemicrobit.com
repro:
import code to microbit.co.uk
https://www.microbit.co.uk/jvkblk
import code to codemicrobit.com
https://codemicrobit.com/tgukzgtdzg
let higherLimit = null;
let voltage = null;
let high_voltage = null;
input.onButtonPressed(Button.A, () => {
basic.showNumber(high_voltage);
basic.pause(2000);
});
high_voltage = 0;
higherLimit = 1024;
basic.forever(() => {
voltage = pins.analogReadPin(AnalogPin.P0);
if (voltage > high_voltage) {
high_voltage = voltage;
}
else {
led.plotBarGraph(voltage, higherLimit);
}
});
here is a screenshot of the program working
when this program is loaded in codemicrobit.com, the same program is NOT working
let voltage = null;
let higherLimit = null;
let high_voltage = null;
input.onButtonPressed(Button.A, () => {
basic.showNumber(high_voltage);
basic.pause(2000);
});
high_voltage = 0;
higherLimit = 1024;
basic.forever(() => {
voltage = pins.analogReadPin(AnalogPin.P0);
if (voltage > high_voltage) {
high_voltage = voltage;
}
else {
led.plotBarGraph(voltage, higherLimit);
}
});
screenshot
the error message is ...
Voltage implicitly has an error type...
So I changed this to...
let voltage = null;
let higherLimit = null;
let high_voltage = null;
input.onButtonPressed(Button.A, () => {
basic.showNumber(high_voltage);
basic.pause(2000);
});
high_voltage = 0;
higherLimit = 1024;
voltage = 0;
basic.forever(() => {
voltage = pins.analogReadPin(AnalogPin.P0);
if (voltage > high_voltage) {
high_voltage = voltage;
}
else {
led.plotBarGraph(voltage, higherLimit);
}
});
possible issue:
the variables are not updating -> variables consistently showing Null
catch the egg lesson - code not rendering - it works in simulator
catch the egg lesson ...
go to
Clicking on the micro:bit icon on the upper left of codemicrobit.com should open a new tab, don’t you think?
1 click on a quiz
2 http://localhost:3232/lessons/lucky-7/quiz
3 broken tag
4 would expect this tag is still available, so there is space for a student to write their answers
with maker activities, students receive a finished program to run on the micro:bit after completing the maker activity
http://localhost:3232/lessons/ornament-chain/activity
http://localhost:3232/lessons/the-watch/activity
here is an example of the issue
1 spinner activity / challenge page not rendering blocks for unknown reason
2 go to activity / challenges
http://localhost:3232/lessons/spinner/activity
http://localhost:3232/lessons/spinner/challenges
3 issue is noted below
Can we make a global search for broken links?
just found this broken link from quiz to 'tutorial'...
http://localhost:3232/lessons/zoomer/quiz
we should also do a global change from /tutorial to /activity...
.../microbit/lessons/zoomer/tutorial
should be...
.../microbit/lessons/zoomer/activity
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.