diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..65a6eec --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["ms-edu.pxt-vscode-web"] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d865f58 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,29 @@ +{ + "editor.formatOnType": true, + "files.autoSave": "afterDelay", + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/built/**": true, + "**/node_modules/**": true, + "**/yotta_modules/**": true, + "**/yotta_targets": true, + "**/pxt_modules/**": true, + "**/.pxt/**": true + }, + "files.associations": { + "*.blocks": "html", + "*.jres": "json" + }, + "search.exclude": { + "**/built": true, + "**/node_modules": true, + "**/yotta_modules": true, + "**/yotta_targets": true, + "**/pxt_modules": true, + "**/.pxt": true + }, + "files.exclude": { + "**/pxt_modules": true, + "**/.pxt": true + } +} \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..91ceacd --- /dev/null +++ b/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'github-pages', group: :jekyll_plugins \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9068464 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +all: deploy + +build: + pxt build + +deploy: + pxt deploy + +test: + pxt test diff --git a/README.md b/README.md new file mode 100644 index 0000000..94cea46 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ + +> Otwórz tę stronę na [https://designcastle.github.io/microbitexperiments/](https://designcastle.github.io/microbitexperiments/) + +## Użyj jako rozszerzenia + +To repozytorium można dodać jako **rozszerzenie** w MakeCode. + +* otwórz [https://makecode.microbit.org/](https://makecode.microbit.org/) +* kliknij na **Nowy Projekt** +* kliknij **Rozszerzenia** w menu oznaczonym kołem zębatym +* szukaj **https://github.com/designcastle/microbitexperiments** i importuj + +## Edytuj ten projekt + +Aby edytować to repozytorium w MakeCode. + +* otwórz [https://makecode.microbit.org/](https://makecode.microbit.org/) +* kliknij **Importuj**, a następnie **Importuj URL** +* wklej **https://github.com/designcastle/microbitexperiments** i kliknij importuj + +#### Metadane (używane do wyszukiwania, renderowania) + +* for PXT/microbit + diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..f56a029 --- /dev/null +++ b/_config.yml @@ -0,0 +1,8 @@ +makecode: + target: microbit + platform: microbit + home_url: https://makecode.microbit.org/ +theme: jekyll-theme-slate +include: + - assets + - README.md diff --git a/main.blocks b/main.blocks new file mode 100644 index 0000000..0f347ec --- /dev/null +++ b/main.blocks @@ -0,0 +1 @@ +xcounterInitialize variables \ No newline at end of file diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..c127ba1 --- /dev/null +++ b/main.ts @@ -0,0 +1,45 @@ +/** + * Simple code developed with use of chatGPT 3.5 + * Tilt board left or right and use A button to check how many times dot touched the edge on left or right side + * Initialize variables + */ +// Function to handle dot movement based on tilt +input.onGesture(Gesture.TiltLeft, function () { + if (x > 0) { + // Move the dot left if not already at the left edge + x += -1 + basic.clearScreen() + led.plot(x, 2) + } else { + // Increment counter when dot reaches the left edge + counter += 1 + } +}) +input.onGesture(Gesture.TiltRight, function () { + if (x < 4) { + // Move the dot right if not already at the right edge + x += 1 + basic.clearScreen() + led.plot(x, 2) + } else { + // Increment counter when dot reaches the right edge + counter += 1 + } +}) +// Function to display total count when A button is pressed +input.onButtonPressed(Button.A, function () { + // Display the total count + basic.showNumber(counter) +}) +let counter = 0 +let x = 0 +// X-coordinate for the center of the board +x = 2 +// Display a single red dot in the center of the board +basic.showLeds(` + . . . . . + . . . . . + . . # . . + . . . . . + . . . . . + `) diff --git a/pxt.json b/pxt.json new file mode 100644 index 0000000..3a14857 --- /dev/null +++ b/pxt.json @@ -0,0 +1,25 @@ +{ + "name": "Tilting", + "description": "", + "dependencies": { + "core": "*", + "radio": "*", + "microphone": "*" + }, + "files": [ + "main.blocks", + "main.ts", + "README.md" + ], + "testFiles": [ + "test.ts" + ], + "targetVersions": { + "target": "6.0.22", + "targetId": "microbit" + }, + "supportedTargets": [ + "microbit" + ], + "preferredEditor": "tsprj" +} diff --git a/test.ts b/test.ts new file mode 100644 index 0000000..9b191f0 --- /dev/null +++ b/test.ts @@ -0,0 +1 @@ +// tu są testy; nie będzie to kompilowane, gdy ten pakiet będzie używany jako rozszerzenie. diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..46f831b --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "ES5", + "noImplicitAny": true, + "outDir": "built", + "rootDir": "." + }, + "exclude": ["pxt_modules/**/*test.ts"] +}