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 29: Riadok 29:


{| class="wikitable" style="width: 100%;"
{| class="wikitable" style="width: 100%;"
|-
|- style="vertical-align:top;"
| style="background: #ffffcc" |
| style="background: #ffffcc" |
'''Javascript'''
'''Javascript'''
Riadok 41: Riadok 41:
|  
|  
'''Python'''
'''Python'''
<source lang="python">
<source lang="python" style="background: red;">


from microbit import *
from microbit import *
Riadok 53: Riadok 53:
|  
|  
'''C++'''
'''C++'''
<source lang="c">
<syntaxhighlight lang=c style="background: #ffffcc">
#include "MicroBit.h"
#include "MicroBit.h"


Riadok 66: Riadok 66:
     release_fiber();
     release_fiber();
}
}
</source>
</syntaxhighlight>


|}
|}
Riadok 87: Riadok 87:
</div>
</div>


<div class="toccolours mw-collapsible mw-collapsed">'''Python'''
Naprogramujte program pre
<div class="mw-collapsible-content">
<source lang="c">
#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();
}
</source>


</div>
</div>




[[Category: Základy počítačov]] [[Category: micro:bit]]
[[Category: Základy počítačov]] [[Category: micro:bit]]

Verzia z 22:57, 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:

Javascript

basic.showString("Hello!")
basic.showIcon(IconNames.Heart)

Python

from microbit import *

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

C++

#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)