Operácie

Žmurkajúci smajlík: Rozdiel medzi revíziami

Z SensorWiki

(Vytvorená stránka „ Zmurkajuci smajlik: <gallery heights=200px mode="packed"> <!-- slideshow? --> Image:microbit-WinkSmiley.png|''Program v blokovom jazyku'' Image:microbit-WinkSmileyRun…“)
 
Riadok 68: Riadok 68:
 
   microbit.show(SMILE_2);
 
   microbit.show(SMILE_2);
 
   delay(200);
 
   delay(200);
 +
}</syntaxhighlight></tab>
 +
<tab name="mBED C++"><syntaxhighlight lang=c style="background: Cornsilk">
 +
#include "MicroBit.h"
 +
 +
MicroBit uBit;
 +
 +
MicroBitImage SMILEY1("0,1,0,1,0 \n"
 +
                      "0,1,0,1,0 \n"
 +
                      "0,0,0,0,0 \n"
 +
                      "1,0,0,0,1 \n"
 +
                      "0,1,1,1,0 \n");
 +
 +
MicroBitImage SMILEY2("0,0,0,1,0 \n"
 +
                      "0,0,0,1,0 \n"
 +
                      "0,0,0,0,0 \n"
 +
                      "1,0,0,0,1 \n"
 +
                      "0,1,1,1,0 \n");
 +
 +
int main()
 +
{
 +
  uBit.init();  // setup
 +
 
 +
  while(1)      // loop
 +
  {
 +
    uBit.display.print(SMILEY1);
 +
    uBit.sleep(1000);
 +
    uBit.display.print(SMILEY2);
 +
    uBit.sleep(200);
 +
  }
 +
 
}</syntaxhighlight></tab>
 
}</syntaxhighlight></tab>
 
</tabs>
 
</tabs>

Verzia zo dňa a času 09:51, 21. jún 2020

Zmurkajuci smajlik:


    
basic.forever(function () {
    basic.showIcon(IconNames.Happy)
    basic.pause(100)
    basic.showLeds(`
        . . . . .
        . # . . .
        . . . . .
        # . . . #
        . # # # .
        `)
    basic.pause(100)
})
from microbit import *


while True:
  display.show(Image("00000:09090:00000:90009:09990"))
  sleep(100)
  display.show(Image("00000:00090:00000:90009:09990"))
  sleep(100)
#include <Adafruit_Microbit.h>

Adafruit_Microbit_Matrix microbit;

const uint8_t SMILE_1[] =
{ B00000,
  B01010,
  B00000,
  B10001,
  B01110,
};

const uint8_t SMILE_2[] =
{ B00000,
  B01000,
  B00000,
  B10001,
  B01110,
};

void setup() {
   microbit.begin();
}

void loop() {
  microbit.show(SMILE_1);
  delay(1000);
  microbit.show(SMILE_2);
  delay(200);
}
#include "MicroBit.h"

MicroBit uBit;

MicroBitImage SMILEY1("0,1,0,1,0 \n"
                      "0,1,0,1,0 \n"
                      "0,0,0,0,0 \n"
                      "1,0,0,0,1 \n"
                      "0,1,1,1,0 \n");

MicroBitImage SMILEY2("0,0,0,1,0 \n"
                      "0,0,0,1,0 \n"
                      "0,0,0,0,0 \n"
                      "1,0,0,0,1 \n"
                      "0,1,1,1,0 \n");

int main()
{
   uBit.init();  // setup
   
  while(1)       // loop
  {
    uBit.display.print(SMILEY1);
    uBit.sleep(1000);
    uBit.display.print(SMILEY2);
    uBit.sleep(200); 
  }

}