Operácie

Micro:bit: Rozdiel medzi revíziami

Zo stránky SensorWiki

Balogh (diskusia | príspevky)
Bez shrnutí editace
Balogh (diskusia | príspevky)
Bez shrnutí editace
Riadok 25: Riadok 25:


Skusime urobit prvy program v rozlicnych jazykoch:
Skusime urobit prvy program v rozlicnych jazykoch:
Tuto bude obrazok v blocks a pod nim tri rozlicne stlpecky, ani nemusia byt collapsible:
{| class="wikitable" style="width: 100%;"
|-
| style="background: #ffffcc" |
<source lang="javascript">
basic.showString("Hello!")
basic.showIcon(IconNames.Heart)
</source>
|
<source lang="python">
from microbit import *
while True:
    display.scroll('Hello, World!')
    display.show(Image.HEART)
    sleep(2000)
</source>
|
<source lang="c">
#include "MicroBit.h"
MicroBit uBit;
int main()
{
    uBit.init();
    uBit.display.scroll("Ahoj :)");
    release_fiber();
}
</source>
|}


<div class="toccolours mw-collapsible mw-collapsed">'''Python'''
<div class="toccolours mw-collapsible mw-collapsed">'''Python'''

Verzia z 22:26, 14. január 2018

Hlavná stránka:

Set of links:



Deep into details:


Skusime urobit prvy program v rozlicnych jazykoch:

Tuto bude obrazok v blocks a pod nim tri rozlicne stlpecky, ani nemusia byt collapsible:

basic.showString("Hello!")
basic.showIcon(IconNames.Heart)
from microbit import *

while True:
    display.scroll('Hello, World!')
    display.show(Image.HEART)
    sleep(2000)
#include "MicroBit.h"

MicroBit uBit;

int main()
{
    uBit.init();

    uBit.display.scroll("Ahoj :)");

    release_fiber();
}
Python

Naprogramujte program pre

# Add your Python code here. E.g.
from microbit import *


while True:
    display.scroll('Hello, World!')
    display.show(Image.HEART)
    sleep(2000)
Python

Naprogramujte program pre

#include "MicroBit.h"

MicroBit uBit;

int main()
{
    // Initialise the micro:bit runtime.
    uBit.init();

    // Insert your code here!
    uBit.display.scroll("Ahoj :)");

    // If main exits, there may still be other fibers running or registered event handlers etc.
    // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then
    // sit in the idle task forever, in a power efficient sleep.
    release_fiber();
}