Operácie

Žmurkajúci smajlík

Z SensorWiki

Verzia z 09:51, 21. jún 2020, ktorú vytvoril Balogh (diskusia | príspevky)

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); 
  }

}