diff --git a/.gitignore b/.gitignore index 46028121..a380d480 100644 --- a/.gitignore +++ b/.gitignore @@ -6,9 +6,11 @@ typings tmp temp projects/** -win10/app/bin -win10/app/bld -win10/*.opendb +clients/win10/app/bin +clients/win10/app/bld +clients/win10/*.opendb +clients/**/bin/** +clients/**/obj/** *.user *.sw? diff --git a/win10/app.sln b/clients/win10/app.sln similarity index 100% rename from win10/app.sln rename to clients/win10/app.sln diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.ps1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.ps1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.ps1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.ps1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/cs-CZ/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/de-DE/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/en-US/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/es-ES/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/fr-FR/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/it-IT/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ja-JP/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ko-KR/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/pl-PL/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/pt-BR/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/ru-RU/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/tr-TR/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-CN/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 b/clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 similarity index 100% rename from win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 rename to clients/win10/app/AppPackages/latest/Add-AppDevPackage.resources/zh-TW/Add-AppDevPackage.psd1 diff --git a/win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.appxbundle b/clients/win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.appxbundle similarity index 100% rename from win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.appxbundle rename to clients/win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.appxbundle diff --git a/win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.cer b/clients/win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.cer similarity index 100% rename from win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.cer rename to clients/win10/app/AppPackages/latest/m.pxt.io_0.1.4.0_AnyCPU_Debug.cer diff --git a/win10/app/BundleArtifacts/neutral.txt b/clients/win10/app/BundleArtifacts/neutral.txt similarity index 100% rename from win10/app/BundleArtifacts/neutral.txt rename to clients/win10/app/BundleArtifacts/neutral.txt diff --git a/win10/app/images/LockScreenLogo.scale-200.png b/clients/win10/app/images/LockScreenLogo.scale-200.png similarity index 100% rename from win10/app/images/LockScreenLogo.scale-200.png rename to clients/win10/app/images/LockScreenLogo.scale-200.png diff --git a/win10/app/images/SplashScreen.scale-200.png b/clients/win10/app/images/SplashScreen.scale-200.png similarity index 100% rename from win10/app/images/SplashScreen.scale-200.png rename to clients/win10/app/images/SplashScreen.scale-200.png diff --git a/win10/app/images/Square150x150Logo.scale-200.png b/clients/win10/app/images/Square150x150Logo.scale-200.png similarity index 100% rename from win10/app/images/Square150x150Logo.scale-200.png rename to clients/win10/app/images/Square150x150Logo.scale-200.png diff --git a/win10/app/images/Square44x44Logo.scale-200.png b/clients/win10/app/images/Square44x44Logo.scale-200.png similarity index 100% rename from win10/app/images/Square44x44Logo.scale-200.png rename to clients/win10/app/images/Square44x44Logo.scale-200.png diff --git a/win10/app/images/Square44x44Logo.targetsize-24_altform-unplated.png b/clients/win10/app/images/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from win10/app/images/Square44x44Logo.targetsize-24_altform-unplated.png rename to clients/win10/app/images/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/win10/app/images/StoreLogo.png b/clients/win10/app/images/StoreLogo.png similarity index 100% rename from win10/app/images/StoreLogo.png rename to clients/win10/app/images/StoreLogo.png diff --git a/win10/app/images/Wide310x150Logo.scale-200.png b/clients/win10/app/images/Wide310x150Logo.scale-200.png similarity index 100% rename from win10/app/images/Wide310x150Logo.scale-200.png rename to clients/win10/app/images/Wide310x150Logo.scale-200.png diff --git a/win10/app/m.pxt.io.jsproj b/clients/win10/app/m.pxt.io.jsproj similarity index 100% rename from win10/app/m.pxt.io.jsproj rename to clients/win10/app/m.pxt.io.jsproj diff --git a/win10/app/msapp-error.css b/clients/win10/app/msapp-error.css similarity index 100% rename from win10/app/msapp-error.css rename to clients/win10/app/msapp-error.css diff --git a/win10/app/msapp-error.html b/clients/win10/app/msapp-error.html similarity index 100% rename from win10/app/msapp-error.html rename to clients/win10/app/msapp-error.html diff --git a/win10/app/msapp-error.js b/clients/win10/app/msapp-error.js similarity index 100% rename from win10/app/msapp-error.js rename to clients/win10/app/msapp-error.js diff --git a/win10/app/package.appxmanifest b/clients/win10/app/package.appxmanifest similarity index 100% rename from win10/app/package.appxmanifest rename to clients/win10/app/package.appxmanifest diff --git a/win10/app/pxtwinapp_TemporaryKey.pfx b/clients/win10/app/pxtwinapp_TemporaryKey.pfx similarity index 100% rename from win10/app/pxtwinapp_TemporaryKey.pfx rename to clients/win10/app/pxtwinapp_TemporaryKey.pfx diff --git a/clients/winuploader/CodeTheMicroBit.Loader.sln b/clients/winuploader/CodeTheMicroBit.Loader.sln new file mode 100644 index 00000000..9c82e656 --- /dev/null +++ b/clients/winuploader/CodeTheMicroBit.Loader.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeTheMicrobit.Uploader", "Microbit.Uploader\CodeTheMicrobit.Uploader.csproj", "{7DC6CA45-FD75-44BC-805E-708C812CD4BF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/clients/winuploader/Microbit.Uploader/App.config b/clients/winuploader/Microbit.Uploader/App.config new file mode 100644 index 00000000..99844edd --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/App.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/CodeTheMicrobit.Uploader.csproj b/clients/winuploader/Microbit.Uploader/CodeTheMicrobit.Uploader.csproj new file mode 100644 index 00000000..077710b6 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/CodeTheMicrobit.Uploader.csproj @@ -0,0 +1,123 @@ + + + + + Debug + AnyCPU + {7DC6CA45-FD75-44BC-805E-708C812CD4BF} + WinExe + Properties + Microsoft.MicroBit + Microbit.Uploader + v2.0 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + AllRules.ruleset + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + false + + + false + + + + + + + + + + + + + + + Form + + + Settings.cs + + + + + Form + + + LicenseDialog.cs + + + Form + + + MainForm.cs + + + + + + + LicenseDialog.cs + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + Settings.cs + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/GlobalSuppressions.cs b/clients/winuploader/Microbit.Uploader/GlobalSuppressions.cs new file mode 100644 index 00000000..8122d89b Binary files /dev/null and b/clients/winuploader/Microbit.Uploader/GlobalSuppressions.cs differ diff --git a/clients/winuploader/Microbit.Uploader/KnownFolders.cs b/clients/winuploader/Microbit.Uploader/KnownFolders.cs new file mode 100644 index 00000000..0c9f1584 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/KnownFolders.cs @@ -0,0 +1,33 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Management; +using System.Runtime.InteropServices; +using System.Security; + +namespace Microsoft.MicroBit +{ + /// + /// Class containing methods to retrieve specific file system paths. + /// + internal static class KnownFoldersNativeMethods + { + [SecurityCritical] + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] + public static string GetDownloadPath() + { + IntPtr outPath; + int result = SHGetKnownFolderPath(new Guid("{374DE290-123F-4565-9164-39C4925E467B}"), 0x00004000, new IntPtr(0), out outPath); + if (result >= 0) + return Marshal.PtrToStringUni(outPath); + else return null; + } + + [SuppressMessage("Microsoft.Security", "CA5122:PInvokesShouldNotBeSafeCriticalFxCopRule")] + [DllImport("Shell32.dll")] + [SecurityCritical] + private static extern int SHGetKnownFolderPath( + [MarshalAs(UnmanagedType.LPStruct)]Guid rfid, uint dwFlags, IntPtr hToken, + out IntPtr ppszPath); + } + +} \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/LicenseDialog.Designer.cs b/clients/winuploader/Microbit.Uploader/LicenseDialog.Designer.cs new file mode 100644 index 00000000..bf8ed131 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/LicenseDialog.Designer.cs @@ -0,0 +1,93 @@ +namespace Microsoft.MicroBit +{ + partial class LicenseDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox = new System.Windows.Forms.RichTextBox(); + this.acceptButton = new System.Windows.Forms.Button(); + this.exitButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBox + // + this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.textBox.Location = new System.Drawing.Point(13, 13); + this.textBox.Name = "textBox"; + this.textBox.ReadOnly = true; + this.textBox.Size = new System.Drawing.Size(465, 438); + this.textBox.TabIndex = 0; + this.textBox.Text = ""; + // + // acceptButton + // + this.acceptButton.Location = new System.Drawing.Point(322, 457); + this.acceptButton.Name = "acceptButton"; + this.acceptButton.Size = new System.Drawing.Size(75, 23); + this.acceptButton.TabIndex = 1; + this.acceptButton.Text = "Accept"; + this.acceptButton.UseVisualStyleBackColor = true; + this.acceptButton.Click += new System.EventHandler(this.acceptButton_Click); + // + // exitButton + // + this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.exitButton.Location = new System.Drawing.Point(403, 457); + this.exitButton.Name = "exitButton"; + this.exitButton.Size = new System.Drawing.Size(75, 23); + this.exitButton.TabIndex = 2; + this.exitButton.Text = "Exit"; + this.exitButton.UseVisualStyleBackColor = true; + this.exitButton.Click += new System.EventHandler(this.exitButton_Click); + // + // LicenseDialog + // + this.AcceptButton = this.acceptButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.exitButton; + this.ClientSize = new System.Drawing.Size(490, 492); + this.ControlBox = false; + this.Controls.Add(this.exitButton); + this.Controls.Add(this.acceptButton); + this.Controls.Add(this.textBox); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "LicenseDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "code the micro:bit uploader Terms Of Use"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.RichTextBox textBox; + private System.Windows.Forms.Button acceptButton; + private System.Windows.Forms.Button exitButton; + } +} \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/LicenseDialog.cs b/clients/winuploader/Microbit.Uploader/LicenseDialog.cs new file mode 100644 index 00000000..22c7a087 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/LicenseDialog.cs @@ -0,0 +1,32 @@ +using Microsoft.MicroBit.Properties; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace Microsoft.MicroBit +{ + public partial class LicenseDialog : Form + { + public LicenseDialog() + { + InitializeComponent(); + this.textBox.Rtf = Resources.MSR_LA___2576; + } + + private void acceptButton_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Yes; + this.Close(); + } + + private void exitButton_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.No; + this.Close(); + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/LicenseDialog.resx b/clients/winuploader/Microbit.Uploader/LicenseDialog.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/LicenseDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/MSFT_logo_png.png b/clients/winuploader/Microbit.Uploader/MSFT_logo_png.png new file mode 100644 index 00000000..60c210e1 Binary files /dev/null and b/clients/winuploader/Microbit.Uploader/MSFT_logo_png.png differ diff --git a/clients/winuploader/Microbit.Uploader/MainForm.Designer.cs b/clients/winuploader/Microbit.Uploader/MainForm.Designer.cs new file mode 100644 index 00000000..cf9a6d0c --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/MainForm.Designer.cs @@ -0,0 +1,172 @@ +namespace Microsoft.MicroBit +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); + this.statusLabel = new System.Windows.Forms.Label(); + this.backgroundPictureBox = new System.Windows.Forms.PictureBox(); + this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.versionLabel = new System.Windows.Forms.LinkLabel(); + this.label1 = new System.Windows.Forms.Label(); + this.SettingsLabel = new System.Windows.Forms.LinkLabel(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); + ((System.ComponentModel.ISupportInitialize)(this.backgroundPictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // statusLabel + // + this.statusLabel.BackColor = System.Drawing.SystemColors.Window; + this.statusLabel.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.statusLabel.Location = new System.Drawing.Point(11, 30); + this.statusLabel.Name = "statusLabel"; + this.statusLabel.Size = new System.Drawing.Size(364, 23); + this.statusLabel.TabIndex = 1; + this.statusLabel.Text = "loading..."; + // + // backgroundPictureBox + // + this.backgroundPictureBox.BackColor = System.Drawing.Color.White; + this.backgroundPictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.backgroundPictureBox.Image = global::Microsoft.MicroBit.Properties.Resources.MSFT_logo_png; + this.backgroundPictureBox.InitialImage = null; + this.backgroundPictureBox.Location = new System.Drawing.Point(226, 91); + this.backgroundPictureBox.Name = "backgroundPictureBox"; + this.backgroundPictureBox.Size = new System.Drawing.Size(149, 52); + this.backgroundPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.backgroundPictureBox.TabIndex = 0; + this.backgroundPictureBox.TabStop = false; + this.backgroundPictureBox.Click += new System.EventHandler(this.backgroundPictureBox_Click); + // + // trayIcon + // + this.trayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("trayIcon.Icon"))); + this.trayIcon.Visible = true; + this.trayIcon.Click += new System.EventHandler(this.trayIcon_Click); + // + // versionLabel + // + this.versionLabel.AutoSize = true; + this.versionLabel.Location = new System.Drawing.Point(12, 121); + this.versionLabel.Name = "versionLabel"; + this.versionLabel.Size = new System.Drawing.Size(28, 13); + this.versionLabel.TabIndex = 2; + this.versionLabel.TabStop = true; + this.versionLabel.Text = "v0.9"; + this.versionLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.versionLabel_LinkClicked); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 103); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(169, 15); + this.label1.TabIndex = 3; + this.label1.Text = "Automatic upload of .hex files."; + // + // SettingsLabel + // + this.SettingsLabel.AutoSize = true; + this.SettingsLabel.Location = new System.Drawing.Point(151, 121); + this.SettingsLabel.Name = "SettingsLabel"; + this.SettingsLabel.Size = new System.Drawing.Size(43, 13); + this.SettingsLabel.TabIndex = 4; + this.SettingsLabel.TabStop = true; + this.SettingsLabel.Text = "settings"; + this.SettingsLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SettingsLabel_LinkClicked); + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictureBox1.Image = global::Microsoft.MicroBit.Properties.Resources.microbit_red; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(226, 6); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(149, 79); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 5; + this.pictureBox1.TabStop = false; + // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(62, 121); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(60, 13); + this.linkLabel1.TabIndex = 6; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "open editor"; + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(388, 143); + this.Controls.Add(this.linkLabel1); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.SettingsLabel); + this.Controls.Add(this.label1); + this.Controls.Add(this.versionLabel); + this.Controls.Add(this.statusLabel); + this.Controls.Add(this.backgroundPictureBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.Name = "MainForm"; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "code the micro:bit uploader"; + this.Load += new System.EventHandler(this.MainForm_Load); + ((System.ComponentModel.ISupportInitialize)(this.backgroundPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox backgroundPictureBox; + private System.Windows.Forms.Label statusLabel; + private System.Windows.Forms.NotifyIcon trayIcon; + private System.Windows.Forms.LinkLabel versionLabel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.LinkLabel SettingsLabel; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.LinkLabel linkLabel1; + } +} + diff --git a/clients/winuploader/Microbit.Uploader/MainForm.cs b/clients/winuploader/Microbit.Uploader/MainForm.cs new file mode 100644 index 00000000..2800bda3 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/MainForm.cs @@ -0,0 +1,266 @@ +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Security; +using System.Threading; +using System.Windows.Forms; + +namespace Microsoft.MicroBit +{ + internal partial class MainForm : Form + { + FileSystemWatcher watcher; + private string customcopypath = ""; + + public MainForm() + { + InitializeComponent(); + var v = typeof(MainForm).Assembly.GetName().Version; + this.versionLabel.Text = "v" + v.Major + "." + v.Minor; + } + + private void MainForm_Load(object sender, EventArgs e) + { + this.initializeFileWatch(); + customcopypath = (string)Application.UserAppDataRegistry.GetValue("CustomDirectory", ""); + this.openEditor(); + } + + private void openEditor() + { + // lanch editor + try { Process.Start("https://codethemicrobit.com"); } catch (Exception) { } + } + + private void initializeFileWatch() + { + if (!checkTOU()) return; + + var downloads = KnownFoldersNativeMethods.GetDownloadPath(); + if (downloads == null) + { + this.updateStatus("oops, can't find the `Downloads` folder"); + return; + } + + this.watcher = new FileSystemWatcher(downloads); + this.watcher.Renamed += (sender, e) => this.handleFileEvent(e); + this.watcher.Created += (sender, e) => this.handleFileEvent(e); + this.watcher.EnableRaisingEvents = true; + + this.waitingForHexFileStatus(); + } + + private void waitingForHexFileStatus() + { + this.updateStatus("waiting for .hex file..."); + this.trayIcon.ShowBalloonTip(3000, "ready...", "waiting for .hex file...", ToolTipIcon.None); + } + + static bool checkTOU() + { + var v = (int)Application.UserAppDataRegistry.GetValue("TermOfUse", 0); + if (v != 1) + { + using (var f = new LicenseDialog()) + { + var r = f.ShowDialog(); + if (r != DialogResult.Yes) + { + Application.Exit(); + return false; + } + } + Application.UserAppDataRegistry.SetValue("TermOfUse", 1, RegistryValueKind.DWord); + } + + return true; + } + + delegate void Callback(); + + private void updateStatus(string value) + { + Callback a = (Callback)(() => + { + this.statusLabel.Text = value; + this.trayIcon.Text = value; + }); + this.Invoke(a); + } + + void handleFileEvent(FileSystemEventArgs e) + { + this.handleFile(e.FullPath); + } + + volatile int copying; + void handleFile(string fullPath) + { + try + { + // In case this is data-url download, at least Chrome will not rename file, but instead write to it + // directly. This mean we may catch it in the act. Let's leave it some time to finish writing. + Thread.Sleep(500); + + var info = new System.IO.FileInfo(fullPath); + Trace.WriteLine("download: " + info.FullName); + + if (info.Extension != ".hex") return; + + var infoName = info.Name; + Trace.WriteLine("download name: " + info.Name); + if (!infoName.StartsWith("microbit-", StringComparison.OrdinalIgnoreCase)) return; + if (info.Name.EndsWith(".uploaded.hex", StringComparison.OrdinalIgnoreCase)) return; + if (info.Length > 1000000) return; // make sure we don't try to copy large files + + + // already copying? + if (Interlocked.Exchange(ref this.copying, 1) == 1) + return; + + try + { + + var driveletters = getMicrobitDrives(); + List drives = new List(); + foreach (var d in driveletters) + { + drives.Add(d.RootDirectory.FullName); + } + if (!String.IsNullOrEmpty(customcopypath) && Directory.Exists(customcopypath)) + { + drives.Add(customcopypath); + } + if (drives.Count == 0) + { + this.updateStatus("no board found"); + this.trayIcon.ShowBalloonTip(3000, "cancelled uploading...", "no board found", ToolTipIcon.None); + return; + } + + this.updateStatus("uploading .hex file"); + this.trayIcon.ShowBalloonTip(3000, "uploading...", "uploading .hex file", ToolTipIcon.None); + + // copy to all boards + copyFirmware(info.FullName, drives); + + // move away hex file + var temp = System.IO.Path.ChangeExtension(info.FullName, ".uploaded.hex"); + try + { + File.Copy(info.FullName, temp, true); + File.Delete(info.FullName); + } + catch (IOException) { } + catch (NotSupportedException) { } + catch (UnauthorizedAccessException) { } + catch (ArgumentException) { } + + // update ui + this.updateStatus("uploading done"); + this.waitingForHexFileStatus(); + } + finally + { + Interlocked.Exchange(ref this.copying, 0); + } + } + catch (IOException) { } + catch (NotSupportedException) { } + catch (UnauthorizedAccessException) { } + catch (ArgumentException) { } + } + + static void copyFirmware(string file, List drives) + { + var waitHandles = new List(); + foreach (var drive in drives) + { + var ev = new AutoResetEvent(false); + waitHandles.Add(ev); + ThreadPool.QueueUserWorkItem((state) => + { + try + { + var trg = System.IO.Path.Combine(drive, "firmware.hex"); + File.Copy(file, trg, true); + } + catch (IOException) { } + catch (NotSupportedException) { } + catch (UnauthorizedAccessException) { } + catch (ArgumentException) { } + ev.Set(); + }, ev); + } + + //waits for all the threads (waitHandles) to call the .Set() method + //and inform that the execution has finished. + WaitHandle.WaitAll(waitHandles.ToArray()); + } + + static DriveInfo[] getMicrobitDrives() + { + var drives = System.IO.DriveInfo.GetDrives(); + var r = new System.Collections.Generic.List(); + foreach (var di in drives) + { + var label = getVolumeLabel(di); + if (label.StartsWith("MICROBIT", StringComparison.Ordinal)) + r.Add(di); + } + return r.ToArray(); + } + + static string getVolumeLabel(DriveInfo di) + { + try { return di.VolumeLabel; } + catch (IOException) { } + catch (SecurityException) { } + catch (UnauthorizedAccessException) { } + return ""; + } + + private void trayIcon_Click(object sender, EventArgs e) + { + this.WindowState = FormWindowState.Minimized; + this.WindowState = FormWindowState.Normal; + this.Show(); + this.Activate(); + } + + private void versionLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try + { + Process.Start("https://codethemicrobit.com/uploader"); + } + catch (IOException) { } + } + + private void backgroundPictureBox_Click(object sender, EventArgs e) + { + try + { + Process.Start("https://codethemicrobit.com"); + } + catch (IOException) { } + } + + private void SettingsLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + var settings = new Settings(customcopypath); + settings.ShowDialog(); + customcopypath = settings.CustomCopyPath; + Application.UserAppDataRegistry.SetValue("CustomDirectory", customcopypath, RegistryValueKind.String); + } + + private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + this.openEditor(); + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/MainForm.resx b/clients/winuploader/Microbit.Uploader/MainForm.resx new file mode 100644 index 00000000..6a64aeb4 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/MainForm.resx @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAMIOAADCDgAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAN6bIZTOkxoUtj62FL5W1hTWpzYUvlbWFLY+thTKgwoUxnb+FLY6shS6TsoUzpMaFL5a1hS2P + rYUxnb6FNZ2+ZTCTsvkriaf/KYKe/yuIpf8uk7L/K4il/ymBnP8tjqz/K4qn/yiBnP8qhaL/KoWh/yqG + o/8ogJv/JXeQ/yqDnvkRMjz/Di02/wofJv8MJS3/Di02/wskLP8HGB3/Di43/w0qM/8HFxz/CyMr/w4s + Nv8MJi7/CiAm/w4sNv8RMTv/BQsN/wUQE/8BAgL/AQQF/wYRFP8EBgf/AgIA/xAYJv8TGy3/AgIA/wMF + Bv8HEhX/AQUG/wECAv8FEBT/BQsN/wYFD/8LByT/AQAC/wAAAP8CAgL/AwMD/woKEv8LCxT/DAwY/woK + Ev8DAwT/AgIC/wAAAP8AAAD/AAAA/wICAv8JCA//IBs//wwMEP8AAAD/AgIC/wQEBv8bGzf/BgYK/wQE + Bf8bGzj/BgYJ/wMDA/8AAAD/CgoK/xEREf8HBwf/Li4u/1FRUf9ERET/AQEA/wwMGf8UFCj/BAQE/wMD + Av8DAwL/BAQE/xAQIP8RESL/AAAA/z8/P/9SUlH/NTU1/y4uLv9QUFD/QUFB/wEBAP8LCxf/EhIk/wIC + Af8JCRH/CwsV/wICAf8PDx3/Dw8f/wAAAP89PT3/UVFQ/zQ0M/8FBQX/DAwM/wgICP8AAAD/CwsW/xIS + JP8FBQb/Dg4b/xERIv8FBQb/Dw8d/w8PHv8AAAD/CAgK/xwXO/8KCRT/BAMI/wAAAP8AAAD/AAAA/wIC + Av8EBAX/HR06/wgIEP8GBgv/HR07/wYGCf8DAwL/AAAA/wAAAP8JBh3/BwUS/y0fhf8FBBD/AAAA/wAA + AP8AAAD/AAAA/xIOMv8fFVz/HhVa/xQPOP8AAQD/AAAA/wAAAP8AAAD/AAAA/wICAv9UO/v/MiKX/wUD + D/8FAw7/AwIK/wAAAP8RCzP/IBZi/yAWYP8TDTr/AAAA/wAAAP8AAAD/AAAA/wAAAP8CAgL/VTz/+FQ6 + /P8yI5j/IBZg/ywehf8MCCX/BAMN/wUEEP8GBBH/AQED/wAAAP8AAAD/AAAA/wAAAP8AAAD/AgIC9Vc+ + /2BVOv9+Ujj0fTwptH5ONul9OCapfRUOPn4AAAB+AAAAfQAAAH4AAAB+AAAAfQAAAH4AAAB+AAAAfgQE + BFkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAA== + + + + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAMIOAADCDgAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAN6bIZTOkxoUtj62FL5W1hTWpzYUvlbWFLY+thTKgwoUxnb+FLY6shS6TsoUzpMaFL5a1hS2P + rYUxnb6FNZ2+ZTCTsvkriaf/KYKe/yuIpf8uk7L/K4il/ymBnP8tjqz/K4qn/yiBnP8qhaL/KoWh/yqG + o/8ogJv/JXeQ/yqDnvkRMjz/Di02/wofJv8MJS3/Di02/wskLP8HGB3/Di43/w0qM/8HFxz/CyMr/w4s + Nv8MJi7/CiAm/w4sNv8RMTv/BQsN/wUQE/8BAgL/AQQF/wYRFP8EBgf/AgIA/xAYJv8TGy3/AgIA/wMF + Bv8HEhX/AQUG/wECAv8FEBT/BQsN/wYFD/8LByT/AQAC/wAAAP8CAgL/AwMD/woKEv8LCxT/DAwY/woK + Ev8DAwT/AgIC/wAAAP8AAAD/AAAA/wICAv8JCA//IBs//wwMEP8AAAD/AgIC/wQEBv8bGzf/BgYK/wQE + Bf8bGzj/BgYJ/wMDA/8AAAD/CgoK/xEREf8HBwf/Li4u/1FRUf9ERET/AQEA/wwMGf8UFCj/BAQE/wMD + Av8DAwL/BAQE/xAQIP8RESL/AAAA/z8/P/9SUlH/NTU1/y4uLv9QUFD/QUFB/wEBAP8LCxf/EhIk/wIC + Af8JCRH/CwsV/wICAf8PDx3/Dw8f/wAAAP89PT3/UVFQ/zQ0M/8FBQX/DAwM/wgICP8AAAD/CwsW/xIS + JP8FBQb/Dg4b/xERIv8FBQb/Dw8d/w8PHv8AAAD/CAgK/xwXO/8KCRT/BAMI/wAAAP8AAAD/AAAA/wIC + Av8EBAX/HR06/wgIEP8GBgv/HR07/wYGCf8DAwL/AAAA/wAAAP8JBh3/BwUS/y0fhf8FBBD/AAAA/wAA + AP8AAAD/AAAA/xIOMv8fFVz/HhVa/xQPOP8AAQD/AAAA/wAAAP8AAAD/AAAA/wICAv9UO/v/MiKX/wUD + D/8FAw7/AwIK/wAAAP8RCzP/IBZi/yAWYP8TDTr/AAAA/wAAAP8AAAD/AAAA/wAAAP8CAgL/VTz/+FQ6 + /P8yI5j/IBZg/ywehf8MCCX/BAMN/wUEEP8GBBH/AQED/wAAAP8AAAD/AAAA/wAAAP8AAAD/AgIC9Vc+ + /2BVOv9+Ujj0fTwptH5ONul9OCapfRUOPn4AAAB+AAAAfQAAAH4AAAB+AAAAfQAAAH4AAAB+AAAAfgQE + BFkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAA== + + + \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/Program.cs b/clients/winuploader/Microbit.Uploader/Program.cs new file mode 100644 index 00000000..8c8cc288 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Program.cs @@ -0,0 +1,30 @@ +using Microsoft.VisualBasic.ApplicationServices; +using System; +using System.Windows.Forms; + +namespace Microsoft.MicroBit +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + SingleInstanceAppStarter.Start(new MainForm(), StartNewInstance); + } + + // The handler when attempting to start another instance of this application + // We can customize the logic here for which form to activate in different + // conditions. Like in this sample, we will be selectively activate the LoginForm + // or MainForm based on the login state of the user. + static void StartNewInstance(object sender, StartupNextInstanceEventArgs e) + { + e.BringToForeground = true; + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/Properties/AssemblyInfo.cs b/clients/winuploader/Microbit.Uploader/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..ef356c48 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Properties/AssemblyInfo.cs @@ -0,0 +1,40 @@ +using System; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Code The micro:bit Uploader")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("MicrosoftMicrobitUploader")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("7dc6ca45-fd75-44bc-805e-708c812cd4bf")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.9.0.0")] +[assembly: AssemblyFileVersion("0.9.0.0")] +[assembly: CLSCompliant(true)] +[assembly: NeutralResourcesLanguage("en-US")] \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/Properties/Resources.Designer.cs b/clients/winuploader/Microbit.Uploader/Properties/Resources.Designer.cs new file mode 100644 index 00000000..356a30a3 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Properties/Resources.Designer.cs @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.MicroBit.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.MicroBit.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap microbit_red { + get { + object obj = ResourceManager.GetObject("microbit_red", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap MSFT_logo_png { + get { + object obj = ResourceManager.GetObject("MSFT_logo_png", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;} + ///{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fbidi \fnil\fcharset2\fp [rest of string was truncated]";. + /// + internal static string MSR_LA___2576 { + get { + return ResourceManager.GetString("MSR_LA___2576", resourceCulture); + } + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/Properties/Resources.resx b/clients/winuploader/Microbit.Uploader/Properties/Resources.resx new file mode 100644 index 00000000..b9194340 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Properties/Resources.resx @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\MSR-LA - 2576.rtf;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\MSFT_logo_png.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\microbit.red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/Resources/MSR-LA - 2576.rtf b/clients/winuploader/Microbit.Uploader/Resources/MSR-LA - 2576.rtf new file mode 100644 index 00000000..2fd9f957 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Resources/MSR-LA - 2576.rtf @@ -0,0 +1 @@ +TBD \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/Settings.Designer.cs b/clients/winuploader/Microbit.Uploader/Settings.Designer.cs new file mode 100644 index 00000000..04615446 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Settings.Designer.cs @@ -0,0 +1,76 @@ +namespace Microsoft.MicroBit +{ + partial class Settings + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(107, 12); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 0; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(34, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(67, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Custom Path"; + // + // Settings + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(246, 48); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Settings"; + this.ShowIcon = false; + this.Text = "Settings"; + this.Load += new System.EventHandler(this.Settings_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/Settings.cs b/clients/winuploader/Microbit.Uploader/Settings.cs new file mode 100644 index 00000000..e2a4f3a4 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Settings.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Security.AccessControl; +using System.Text; +using System.Windows.Forms; + +namespace Microsoft.MicroBit +{ + public partial class Settings : Form + { + public string CustomCopyPath; + public Settings(string currentpath) + { + InitializeComponent(); + CustomCopyPath = currentpath; + + } + + private void Settings_Load(object sender, EventArgs e) + { + textBox1.Text = CustomCopyPath; + } + + private void label1_Click(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + CustomCopyPath = textBox1.Text; + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/Settings.resx b/clients/winuploader/Microbit.Uploader/Settings.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/Settings.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/clients/winuploader/Microbit.Uploader/SingleInstanceAppHelper.cs b/clients/winuploader/Microbit.Uploader/SingleInstanceAppHelper.cs new file mode 100644 index 00000000..e57d20d2 --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/SingleInstanceAppHelper.cs @@ -0,0 +1,39 @@ +/****************************** Module Header ******************************\ +* Module Name: SingleInstanceAppHelper.cs +* Project: CSWinFormSingleInstanceApp +* Copyright (c) Microsoft Corporation. +* +* The sample demonstrates how to achieve the goal that only +* one instance of the application is allowed in Windows Forms application.. +* +* This source is subject to the Microsoft Public License. +* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL. +* All other rights reserved. +* +* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +\***************************************************************************/ + +using System; +using Microsoft.VisualBasic.ApplicationServices; +using System.Windows.Forms; + +namespace Microsoft.MicroBit +{ + // We need to add Microsoft.VisualBasic reference to use + // WindowsFormsApplicationBase type. + class SingleInstanceApp : WindowsFormsApplicationBase + { + public SingleInstanceApp() + { + } + public SingleInstanceApp(Form f) + { + // Set IsSingleInstance property to true to make the application + base.IsSingleInstance = true; + // Set MainForm of the application. + this.MainForm = f; + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/SingleInstanceAppStarter.cs b/clients/winuploader/Microbit.Uploader/SingleInstanceAppStarter.cs new file mode 100644 index 00000000..f3b9b6bb --- /dev/null +++ b/clients/winuploader/Microbit.Uploader/SingleInstanceAppStarter.cs @@ -0,0 +1,39 @@ +/****************************** Module Header ******************************\ +* Module Name: SingleInstanceAppStarter.cs +* Project: CSWinFormSingleInstanceApp +* Copyright (c) Microsoft Corporation. +* +* The sample demonstrates how to achieve the goal that only +* one instance of the application is allowed in Windows Forms application.. +* +* This source is subject to the Microsoft Public License. +* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL. +* All other rights reserved. +* +* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +\***************************************************************************/ + +using System; +using System.Windows.Forms; +using Microsoft.VisualBasic.ApplicationServices; + +namespace Microsoft.MicroBit +{ + internal static class SingleInstanceAppStarter + { + static SingleInstanceApp app = null; + + // Construct SingleInstanceApp object, and invoke its run method. + public static void Start(Form f, StartupNextInstanceEventHandler handler) + { + if (app == null && f != null) + app = new SingleInstanceApp(f); + + // Wire up StartupNextInstance event handler. + app.StartupNextInstance += handler; + app.Run(Environment.GetCommandLineArgs()); + } + } +} diff --git a/clients/winuploader/Microbit.Uploader/favicon.ico b/clients/winuploader/Microbit.Uploader/favicon.ico new file mode 100644 index 00000000..f4f666c8 Binary files /dev/null and b/clients/winuploader/Microbit.Uploader/favicon.ico differ diff --git a/clients/winuploader/Microbit.Uploader/microbit.red.png b/clients/winuploader/Microbit.Uploader/microbit.red.png new file mode 100644 index 00000000..9b2a5efa Binary files /dev/null and b/clients/winuploader/Microbit.Uploader/microbit.red.png differ diff --git a/docs/about.md b/docs/about.md index 60b63365..77c0b8fb 100644 --- a/docs/about.md +++ b/docs/about.md @@ -35,7 +35,7 @@ Learn about about the [hardware components](/device) of the micro:bit to make th ## Programming: Blocks or JavaScript -The student can program the BBC micro:bit using [Blocks](/blocks) or [JavaScript](/typescript), via the [micro:bit APIs](/reference): +The student can program the BBC micro:bit using [Blocks](/blocks) or [JavaScript](/javascript), via the [micro:bit APIs](/reference): ```blocks basic.showString("Hi!"); @@ -45,7 +45,7 @@ basic.showString("Hi!"); When a user has her code ready, she can connect her BBC micro:bit to a computer via a USB cable, so it appears as a mounted drive (named MICROBIT). -Compilation to ARM thumb machine code from [Blocks](/blocks) or [JavaScript](/typescript) happens in the browser. +Compilation to ARM thumb machine code from [Blocks](/blocks) or [JavaScript](/javascript) happens in the browser. The student is prompted to save the ARM binary program to a file, which she then simply drags to the micro:bit mounted drive, which flashes the micro:bit device with the new program. diff --git a/docs/faq.md b/docs/faq.md index 340c0453..76337f92 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,6 +1,12 @@ # Frequently Asked Questions -## Where can I get a BBC micro:bit? +### Where can I get a BBC micro:bit? More information at [http://uk.farnell.com/bbc-microbit](http://uk.farnell.com/bbc-microbit). + +## Troubleshooting + +### My micro:bit does not show up as a drive when I connect it to my computer. + +A common cause for this is a broken cable. Pick another USB cable and try it. Otherwise, try another computer as well. \ No newline at end of file diff --git a/docs/getting-started.md b/docs/getting-started.md index 543860c4..c7438317 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -11,8 +11,9 @@ to make real programs that work! ### Happy face -There are three blocks in the editor (the area to the left). -Arrange them to look like this: +Use the **Basic** drawer in the editor (to the left) +to drag out and arrange three blocks (two `show leds` and one `forever` block) +to create this program: ```blocks basic.forever(() => { @@ -33,7 +34,7 @@ basic.forever(() => { }); ``` -When you run this program, you will see a smiley face, then a blank +When you run this program (click the **Play** button) you will see a smiley face, then a blank screen, then a smiley again -- it never stops! (That's because of the ``forever`` block.) @@ -69,7 +70,7 @@ Click **Compile** to move your program to the BBC micro:bit! ### Your turn! -Pile up more ``show leds`` blocks to create your animation! Create an +Pile up more ``show leds`` blocks to create an animation! Create an animation with at least 5 pictures. What does this animation show? ```blocks @@ -496,7 +497,7 @@ input.onButtonPressed(Button.B, () => { ``` Click **Compile** to move your program to the BBC micro:bit! -## Your turn! -How else can you make your game better? -Ever hear of [Rock Paper Scissors Spock Lizard](http://www.samkass.com/theories/RPSSL.html)? +# Want to do more? + +There are [10 great projects](/projects) waiting for you. diff --git a/docs/typescript.md b/docs/javascript.md similarity index 90% rename from docs/typescript.md rename to docs/javascript.md index 71e06854..ca3815f0 100644 --- a/docs/typescript.md +++ b/docs/javascript.md @@ -1,10 +1,10 @@ -# TypeScript +# JavaScript -You can write micro:bit programs in a subset of [TypeScript](https://www.typescriptlang.org). -TypeScript itself is a superset of JavaScript, and many micro:bit programs, -especially at the beginner's level, are also just plain JavaScript. +You can write micro:bit programs in a subset of [TypeScript](https://www.typescriptlang.org), a superset of JavaScript. +Many micro:bit programs, especially at the beginner's level, are just plain JavaScript. TypeScript introduces class-based +object-oriented programming, such as: -```js +```typescript class Greeter { greeting: string; constructor(message: string) { diff --git a/docs/lessons/charting/quiz-answers.md b/docs/lessons/charting/quiz-answers.md index 684f44d3..b58dd788 100644 --- a/docs/lessons/charting/quiz-answers.md +++ b/docs/lessons/charting/quiz-answers.md @@ -7,7 +7,7 @@ Measure the acceleration on the micro:bit in the "x" direction. ## Directions -Use this activity document to guide your work in the [glowing pendulum activity](/lessons/charting/acceleration) +Use this activity document to guide your work in the [charting activity](/lessons/charting) Answer the questions while completing the tutorial. Pay attention to the dialogues! diff --git a/docs/lessons/night-light/challenges.md b/docs/lessons/night-light/challenges.md index c12fbe86..aa1d09a0 100644 --- a/docs/lessons/night-light/challenges.md +++ b/docs/lessons/night-light/challenges.md @@ -49,5 +49,3 @@ input.onButtonPressed(Button.B, () => { ### Challenge 3 Add an event handler with `on shake` to change the LED brightness back to a `255`. - -* `Run main` your script to see the LEDs change brightness. diff --git a/docs/lessons/night-light/offset-image/activity.md b/docs/lessons/night-light/offset-image/activity.md deleted file mode 100644 index 6dab515e..00000000 --- a/docs/lessons/night-light/offset-image/activity.md +++ /dev/null @@ -1,94 +0,0 @@ -# offset image challenges - -Coding challenges for the offset image tutorial. - -## Before we get started - -Complete the following exercise. Your code should look like this: - -```blocks -offset = 0 -basic.forever(() => { - if (offset == -4) { - basic.showString("Push button A", 150) - } - images.createImage(` -. . # . . -. . # . . -. . # . . -. # # # . -. . # . . -`).showImage(offset) -}) -input.onButtonPressed(Button.A, () => { - offset = offset + 1 -}) -``` - -### Challenge 1 - -Create a condition for if button `B` is pressed. We want the image to move to the left when button `B` is pressed. - -``` -offset = 0 -basic.forever(() => { - if (offset == -4) { - basic.showString("Push button A", 150) - } - images.createImage(` -. . # . . -. . # . . -. . # . . -. # # # . -. . # . . -`).showImage(offset) -}) -input.onButtonPressed(Button.A, () => { - offset = offset + 1 -}) -input.onButtonPressed(Button.B, () => { - offset = offset - 1 // *** -}) // *** -``` - -* Run the code to see if it works as expected. - -### Challenge 2 - - - -Now we want to make sure that the button does not go off the screen to the right. Add a new line that checks to see if offset = 5 after button `A` is pressed. - -If `offset = 5` then prompt the user to move the image to the left by displaying the text: "Push button B". - -``` -offset = 0 -basic.forever(() => { - if (offset == -4) { - basic.showString("Push button A", 150) - } - if (offset == 5) { - basic.showString("Press Button B", 150) // *** - } - images.createImage(` -. . # . . -. . # . . -. . # . . -. # # # . -. . # . . -`).showImage(offset) -}) -input.onButtonPressed(Button.A, () => { - offset = offset + 1 -}) -input.onButtonPressed(Button.B, () => { - offset = offset - 1 -}) -``` - -* Run the code to see if it works as expected. - -### Challenge 3 - -Now make sure the image does not go off the left side and if it does, prompt the user to push button `A`. - diff --git a/docs/lessons/night-light/offset-image/quiz-answers.md b/docs/lessons/night-light/offset-image/quiz-answers.md deleted file mode 100644 index d9b00e48..00000000 --- a/docs/lessons/night-light/offset-image/quiz-answers.md +++ /dev/null @@ -1,48 +0,0 @@ -# offset image quiz answers - -shift an image horizontally across the display with offset. - -This is the answer key for the [offset image quiz](/lessons/offset-image/quiz). - -## 1. What is a 'if, then, else statement' ? - -
- -An if-then statement will run a block of code if the condition specified is true. The statement will run the "else" block of code if that condition is false. - -## 2. Consider the message - -Write the line of code that that will create the message "Push button A" (Hint: This message appears `if` the offset is equal -4 then the BBC micro:bit will state "Push Button A"). - -
- -``` -if (offset == -4) { - basic.showString("Push Button A", 150) -} -``` - -## 3. Consider the following image - -![](/static/mb/lessons/offset-image-0.png) - -When with this image be displayed? - -
- -When the offset is NOT equal to -4 then the BBC micro:bit will show the image above. - -## 4. Consider the following image - -![](/static/mb/lessons/offset-image-1.png) - -Write the two lines of code that cause the `variable` offset to increase by one when button `A` is pressed. - -
- -``` -input.onButtonPressed(Button.A, () => { - offset = offset + 1 -}) -``` - diff --git a/docs/lessons/night-light/offset-image/quiz.md b/docs/lessons/night-light/offset-image/quiz.md deleted file mode 100644 index 690dd10c..00000000 --- a/docs/lessons/night-light/offset-image/quiz.md +++ /dev/null @@ -1,36 +0,0 @@ -# offset image quiz - -shift an image horizontally across the display with offset. - -## Name - -## Directions - -Use this activity document to guide your work in the [offset image activity](/lessons/offset-image/activity). - -Answer the questions while completing the tutorial. Pay attention to the dialogues! - -## 1. What is an 'if, then, else statement' ? - -
- -## 2. Write the line condition that if true, will display the message "Push button A". This message appears if the offset is equal -4 then the BBC micro:bit will state "Push Button A". - -
- -
- -## 3. Write the one line of code to show this image - -![](/static/mb/lessons/offset-image-0.png) - -
- -
- -## 4. Write the two lines of code that trigger the variable offset to increase by one. - -![](/static/mb/lessons/offset-image-1.png) - -
- diff --git a/docs/lessons/seismograph/challenge.md b/docs/lessons/seismograph/challenge.md index 5bc94e34..8c8134a0 100644 --- a/docs/lessons/seismograph/challenge.md +++ b/docs/lessons/seismograph/challenge.md @@ -106,7 +106,7 @@ Science: Welcome! The activity will teach you how to chart the acceleration of t ## 6. First, notice that moving the 1st micro:bit in the simulator in any direction, you will change the acceleration value of the 2nd micro:bit. Also, notice that by moving the micro:bit simulator, there is a changing acceleration value of the second micro:bit. Second, the flat colored horizontal line will start a waving line on the 2nd micro:bit to display the value of the strength as measured in milli-gravities. Finally, notice that the LED display will fluctate based on the movement of the 2nd micro:bit simulator. -![](/static/mb//lessons/seis_challenge02.png) +![](/static/mb/lessons/seis_challenge02.png) ## 7. diff --git a/docs/projects.md b/docs/projects.md index 21f5af18..68c023c6 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -1,46 +1,55 @@ # Ten Projects -![](/static/mb/projects/all10.png) +### ~avatar avatar -## [Flashing Heart](/projects/flashing-heart) +Here are some cool projects that you can build with your micro:bit! -![](/static/mb/projects/a1-display.png) +### ~ -## [Smiley Buttons](/projects/smiley-buttons) -![](/static/mb/projects/a2-buttons.png) - -## [Love Meter](/projects/love-meter) - -![](/static/mb/projects/a3-pins.png) - -## [Rock Paper Scissors](/projects/rock-paper-scissors) - -![](/static/mb/projects/a4-motion.png) - -## [Compass](/projects/compass) - -![](/static/mb/projects/a5-compass.png) - -## [Hack your headphones](/projects/hack-your-headphones) - -![](/static/mb/projects/a6-music.png) - -## [Banana keyboard](/projects/banana-keyboard) - -![](/static/mb/projects/a7-conductive.png) - -## [Telegraph](/projects/telegraph) - -![](/static/mb/projects/a8-network.png) - -## [Radio](/projects/radio) - -![](/static/mb/projects/a9-radio.png) - -## [Watch](/projects/the-watch) - -![](/static/mb/projects/a10-watch.png) +```codecard +[{ + "name": "Flashing Heart", + "url":"/projects/flashing-heart", + "imageUrl": "/static/mb/projects/a1-display.png" +},{ + "name": "Smiley Buttons", + "url":"/projects/smiley-buttons", + "imageUrl": "/static/mb/projects/a2-buttons.png" +},{ + "name": "Love Meter", + "url":"/projects/lover-meter", + "imageUrl":"/static/mb/projects/a3-pins.png" +},{ + "name": "Rock Paper Scissors", + "url":"/projects/rock-paper-scissors", + "imageUrl":"/static/mb/projects/a4-motion.png" +},{ + "name": "Compass", + "url":"/projects/compass", + "imageUrl":"/static/mb/projects/a5-compass.png" +},{ + "name": "Hack your headphones", + "url":"/projects/hack-your-headphones", + "imageUrl":"/static/mb/projects/a6-music.png" +},{ + "name": "Banana keyboard", + "url":"/projects/banana-keyboard", + "imageUrl":"/static/mb/projects/a7-conductive.png" +},{ + "name": "Telegraph", + "url":"/projects/telegraph", + "imageUrl":"/static/mb/projects/a8-network.png" +},{ + "name": "Radio", + "url":"/projects/radio", + "imageUrl":"/static/mb/projects/a9-radio.png" +},{ + "name": "Watch", + "url":"/projects/the-watch", + "imageUrl":"/static/mb/projects/a10-watch.png" +}] +``` diff --git a/docs/reference.md b/docs/reference.md index c031ca4b..0cbbf586 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -1,4 +1,4 @@ -# Micro:bit APIs +# Reference ```namespaces basic.showNumber(0); diff --git a/docs/reference/basic/clear-screen.md b/docs/reference/basic/clear-screen.md index 81c3b37d..7194348a 100644 --- a/docs/reference/basic/clear-screen.md +++ b/docs/reference/basic/clear-screen.md @@ -6,9 +6,9 @@ Turn off all the LED lights on the [LED screen](/device/screen). basic.clearScreen() ``` -### Example: vanishing heart +### Example: Vanishing heart -The following code shows a heart on the screen and then turns off all the LED lights using `clear screen`: +The following code shows a heart on the screen and then turns off all the LED lights. ```blocks basic.showLeds(` @@ -23,5 +23,5 @@ basic.clearScreen() ### See also -[set brightness](/reference/led/set-brightness), [unplot](/reference/led/unplot), [plot](/reference/led/plot), [Image](/reference/images/image), [clear](/reference/basic/clear-screen) +[set brightness](/reference/led/set-brightness), [unplot](/reference/led/unplot), [plot](/reference/led/plot), [Image](/reference/images/image) diff --git a/docs/reference/devices/on-gamepad-button.md b/docs/reference/devices/on-gamepad-button.md index daf5a4c5..4388eeeb 100644 --- a/docs/reference/devices/on-gamepad-button.md +++ b/docs/reference/devices/on-gamepad-button.md @@ -2,12 +2,13 @@ Register code to run when the micro:bit receives a command from the paired gamepad. -## Bluetooth required - -The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). +### ~hint +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. +### ~ ```sig devices.onGamepadButton(MesDpadButtonInfo.ADown, () => {}) @@ -20,3 +21,7 @@ devices.onGamepadButton(MesDpadButtonInfo.ADown, () => {}) ### See Also [tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength), [on signal strength changed](/reference/devices/on-signal-strength-changed) + +```package +microbit-devices +``` \ No newline at end of file diff --git a/docs/reference/devices/on-signal-strength-changed.md b/docs/reference/devices/on-signal-strength-changed.md index ddc6d918..a66fb00c 100644 --- a/docs/reference/devices/on-signal-strength-changed.md +++ b/docs/reference/devices/on-signal-strength-changed.md @@ -1,15 +1,16 @@ # On Signal Strength Changed -The `on signal strength changed` function. - Register code to run when the signal strength of the paired device changes. -## Bluetooth required - -The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). +### ~hint +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. +### ~ + + ```sig devices.onSignalStrengthChanged(() => {}) ``` @@ -30,5 +31,8 @@ devices.onSignalStrengthChanged(() => { ### See Also -[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified), [signal strength](/reference/devices/signal-strength) +[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [signal strength](/reference/devices/signal-strength) +```package +microbit-devices +``` \ No newline at end of file diff --git a/docs/reference/devices/raise-alert-to.md b/docs/reference/devices/raise-alert-to.md index c467e6af..5477442b 100644 --- a/docs/reference/devices/raise-alert-to.md +++ b/docs/reference/devices/raise-alert-to.md @@ -1,15 +1,15 @@ # raise alert to -The raise alert to function. - Raise an alert on a remote device. -## Bluetooth required - -The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). +### ~hint +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. +### ~ + ```sig export function raiseAlertTo(event: string) @@ -23,41 +23,44 @@ export function raiseAlertTo(event: string) To tell the connected device to display toast -``` +```blocks devices.raiseAlertTo("display toast") ``` To tell the connected device to vibrate -``` +```blocks devices.raiseAlertTo("vibrate") ``` To tell the connected device to play a sound -``` +```blocks devices.raiseAlertTo("play sound") ``` To tell the connected device to play a ringtone -``` +```blocks devices.raiseAlertTo("play ringtone") ``` To tell the connected device to find my phone -``` +```blocks devices.raiseAlertTo("find my phone") ``` To tell the connected device to ring alarm -``` +```blocks devices.raiseAlertTo("ring alarm") ``` ### See also -[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to), [on notified](/reference/devices/on-notified) +[tell remote control to](/reference/devices/tell-remote-control-to), [tell camera to](/reference/devices/tell-camera-to) +```package +microbit-devices +``` \ No newline at end of file diff --git a/docs/reference/devices/receive-number.md b/docs/reference/devices/receive-number.md deleted file mode 100644 index d433d6a6..00000000 --- a/docs/reference/devices/receive-number.md +++ /dev/null @@ -1,36 +0,0 @@ -# Receive Number - -The broadcast function. - -Reads the next radio packet as a number data packet. - -## Important Security Consideration - -The functions in the ``radio`` namespace allow the BBC micro:bit to communicate with other micro:bits. - -This API does not contain any form of encryption, authentication or authorization. It's purpose is solely for use as a teaching aid to demonstrate how simple communications operates, and to provide a sandpit through which learning can take place. - -For serious applications, BLE should be considered a substantially more secure alternative. - -```sig -radio.receiveNumber(); -``` - -### Returns - -* packet - a number received. - -### Examples - -Broadcasts the value of ``acceleration`` x to other micro:bits. - -``` -radio.onDataReceived(() => { - led.plotBarGraph(radio.receiveNumber(), 1023) -}) -``` - -### See also - -[send number](/reference/radio/send-number), [receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received), [set group](/reference/radio/set-group) - diff --git a/docs/reference/devices/signal-strength.md b/docs/reference/devices/signal-strength.md index 549a2fe7..064b1aa3 100644 --- a/docs/reference/devices/signal-strength.md +++ b/docs/reference/devices/signal-strength.md @@ -1,17 +1,17 @@ # Signal Strength -The `signal strength` function. - Returns the signal strength reported by the paired device from ``0`` (no signal) to ``4`` (full strength). -## Important Security Consideration - -The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). +### ~hint +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. -``` -devices.signalStrength() : number +### ~ + +```sig +devices.signalStrength(); ``` ### Returns @@ -22,7 +22,7 @@ devices.signalStrength() : number Display the signal strength on screen: -``` +```blocks devices.onSignalStrengthChanged(() => { basic.showNumber(devices.signalStrength(), 150) }) @@ -30,5 +30,8 @@ devices.onSignalStrengthChanged(() => { ### See Also -[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified), [on signal strength changed](/reference/devices/on-signal-strength-changed) +[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on signal strength changed](/reference/devices/on-signal-strength-changed) +```package +microbit-devices +``` \ No newline at end of file diff --git a/docs/reference/devices/tell-camera-to.md b/docs/reference/devices/tell-camera-to.md index 4ac69338..ed8efcc4 100644 --- a/docs/reference/devices/tell-camera-to.md +++ b/docs/reference/devices/tell-camera-to.md @@ -1,23 +1,17 @@ # tell camera to -The tell camera to function. - Access the photo/video-taking functionality of a remote device using the ``tell camera to`` function. -## Bluetooth required - -The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). +### ~hint +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. -### Block Editor +### ~ -![](/static/mb/tell-camera-to-0.png) - -### JavaScript - -``` -export function tellCameraTo(event: string) +```sig +devices.tellCameraTo() ``` ### Parameters @@ -28,53 +22,56 @@ export function tellCameraTo(event: string) To tell the connected device to take a picture: -``` +```blocks devices.tellCameraTo("take photo") ``` To tell the connected device to start recording a video -``` +```blocks devices.tellCameraTo("start video capture") ``` To tell the connected device to stop recording a video -``` +```blocks devices.tellCameraTo("stop video capture") ``` To tell the connected device to toggle front-rear -``` +```blocks devices.tellCameraTo("toggle front-rear") ``` To tell the connected device to launch photo mode -``` +```blocks devices.tellCameraTo("launch photo mode") ``` To tell the connected device to launch video mode -``` +```blocks devices.tellCameraTo("launch video mode") ``` To tell the connected device to stop photo mode -``` +```blocks devices.tellCameraTo("stop photo mode") ``` To tell the connected device to stop video mode -``` +```blocks devices.tellCameraTo("stop video mode") ``` ### See Also -[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified) +[tell remote control to](/reference/devices/tell-remote-control-to), [raise alert to](/reference/devices/raise-alert-to) +```package +microbit-devices +``` diff --git a/docs/reference/devices/tell-microphone-to.md b/docs/reference/devices/tell-microphone-to.md index b4b82ddf..52879fef 100644 --- a/docs/reference/devices/tell-microphone-to.md +++ b/docs/reference/devices/tell-microphone-to.md @@ -45,14 +45,3 @@ To tell the connected device to stop recording audio ``` devices.tellMicrophoneTo("stop capture") ``` - -### Other show functions - -* use [tell remote control to](/reference/devices/tell-remote-control-to) to control presentation of media content -* use [tell camera to](/reference/devices/tell-camera-to) to control the photo/video recording of connected devices -* use [raise alert to](/reference/devices/raise-alert-to) to control the microphone of connected devices - -### See also - -[Devices](/reference/devices) - diff --git a/docs/reference/devices/tell-remote-control-to.md b/docs/reference/devices/tell-remote-control-to.md index 25549eeb..77f11a1b 100644 --- a/docs/reference/devices/tell-remote-control-to.md +++ b/docs/reference/devices/tell-remote-control-to.md @@ -1,23 +1,17 @@ # tell remote control to -The tell remote control to function. - Control the presentation of media content available on a remote device using the `tell remote control` to function. -## - -The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, such as a smartphone, over Bluetooth (Smart). +### ~hint +The functions in the ``devices`` namespace allow the BBC micro:bit to communicate with a separate (remote) device, +such as a smartphone, over Bluetooth (Smart). The set of supported events will depend on the remote device and the BBC micro:bit apps available for the remote device. -### Block Editor +### ~ -![](/static/mb/tell-remote-control-to-0.png) - -### JavaScript - -``` -export function tellRemoteControlTo(event: string) +```sig +devices.tellRemoteControlTo(event: string) ``` ### Parameters @@ -40,53 +34,57 @@ export function tellRemoteControlTo(event: string) To tell the connected device to start playing: -``` +```blocks devices.tellRemoteControlTo("play") ``` To tell the connected device to stop playing -``` +```blocks devices.tellRemoteControlTo("stop") ``` To tell the connected device to go to next track -``` +```blocks devices.tellRemoteControlTo("next track") ``` To tell the connected device to go to previous track -``` +```blocks devices.tellRemoteControlTo("previous track") ``` To tell the connected device to go forward -``` +```blocks devices.tellRemoteControlTo("forward") ``` To tell the connected device to rewind -``` +```blocks devices.tellRemoteControlTo("rewind") ``` To tell the connected device volume up -``` +```blocks devices.tellRemoteControlTo("volume up") ``` To tell the connected device volume down -``` +```blocks devices.tellRemoteControlTo("volume down") ``` ### See also -[tell camera to](/reference/devices/tell-camera-to), [raise alert to](/reference/devices/raise-alert-to), [on notified](/reference/devices/on-notified) +[tell camera to](/reference/devices/tell-camera-to), [raise alert to](/reference/devices/raise-alert-to) + +```package +microbit-devices +``` diff --git a/docs/reference/images/create-big-image.md b/docs/reference/images/create-big-image.md new file mode 100644 index 00000000..8ac17640 --- /dev/null +++ b/docs/reference/images/create-big-image.md @@ -0,0 +1,46 @@ +# Create Big Image + +Make a big [image](/reference/images/image) (picture) for the micro:bit +[LED screen](/device/screen). The big image made of two squares. +Each of the squares is five LEDs on a side, like a regular image. + +```blocks +images.createBigImage(` + . . # . . . . # . . + . # # # . . . # . . + # . # . # # . # . # + . . # . . . # # # . + . . # . . . . # . . + `); +``` + +### Example: Flip-flopping arrow + +This program makes a big image with a picture of an arrow pointing up, +and an arrow pointing down. If you press button `A`, the program will +show the arrow pointing up, which starts `0` LEDs from the left in the +big image. If you press button `B`, the program will show the arrow +pointing down, which starts `5` LEDs from the left. + +```blocks +let arrows = images.createBigImage(` + . . # . . . . # . . + . # # # . . . # . . + # . # . # # . # . # + . . # . . . # # # . + . . # . . . . # . . + `); +input.onButtonPressed(Button.A, () => { + arrows.showImage(0); +}); +input.onButtonPressed(Button.B, () => { + arrows.showImage(5); +}); +``` + +### See also + +[Getting Started](/getting-started), [image](/reference/images/image), +[create image](/reference/images/create-image), +[show image](/reference/images/show-image), +[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation) diff --git a/docs/reference/images/create-image.md b/docs/reference/images/create-image.md index a5b5eb09..550f0f93 100644 --- a/docs/reference/images/create-image.md +++ b/docs/reference/images/create-image.md @@ -1,6 +1,7 @@ # Create Image -Create an [Image](/reference/images/image) to show on the [LED screen](/device/screen). +Make an [image](/reference/images/image) (picture) for the micro:bit +[LED screen](/device/screen). ```sig images.createImage(` @@ -12,24 +13,37 @@ images.createImage(` `) ``` -### Example: rock, paper, scissors +### Example: Flip-flopping arrow -The following example shows one of three images (rock, paper, or scissors) when you shake the micro:bit: +If you press button `A`, this program will make a picture of an +arrow and show it on the LED screen. If you press button `B`, the +program will show a picture of the arrow upside-down. -``` -input.onGesture(Gesture.Shake, () => { - let rockpaper = images.createImage(` -. . . . . # # # # # . . . . # -. # # # . # . . . # # # . # . -. # # # . # . . . # . # # . . -. # # # . # . . . # # # . # . -. . . . . # # # # # . . . . # -`) - rockpaper.showFrame(Math.random(3)) -}) +```blocks +input.onButtonPressed(Button.A, () => { + images.createImage(` + . . # . . + . # # # . + # . # . # + . . # . . + . . # . . + `).showImage(0); +}); +input.onButtonPressed(Button.B, () => { + images.createImage(` + . . # . . + . . # . . + # . # . # + . # # # . + . . # . . + `).showImage(0); +}); ``` ### See also -[show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/image/show-image), [scroll image](/reference/image/scroll-image) +[Getting Started](/getting-started), [image](/reference/images/image), +[create big image](/reference/images/create-big-image), +[show image](/reference/images/show-image), +[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation) diff --git a/docs/reference/images/scroll-image.md b/docs/reference/images/scroll-image.md index 0ca0f46a..19379977 100644 --- a/docs/reference/images/scroll-image.md +++ b/docs/reference/images/scroll-image.md @@ -1,70 +1,45 @@ # Scroll Image -The scroll image function. - -Scrolls the frames within an [Image](/reference/images/image) on the [LED screen](/device/screen). - -### Block Editor - -![](/static/mb/scroll-image-0.png) - -### JavaScript - -``` -export function scrollImage(_this: micro_bit.Image, xOffsetPerStep: number, interval: number) -``` +Scroll (slide) an [image](/reference/images/image) (picture) from one +side to the other of the [LED screen](/device/screen). ### Parameters -* x offset per step : [Number](/reference/types/number) - the number of columns to scroll at a time (horizontal offset). Use a positive number to scroll an image to the right and a negative number to scroll left. To jump from one image frame to the next, use an offset of 5 or -5. -* interval (ms) : [Number](/reference/types/number) - the time (in milliseconds) before scrolling by `x offset per step`; the larger the number, the slower the scroll. +* ``offset`` is a [number](/reference/types/number) that means + how many LEDs to scroll at a time, from right to left or + left to right. If you use a positive number like `2`, the image + will scroll from the right side of the screen to the left. + If you use a negative number like `-2`, the image will scroll + in the other direction. If you use `5` or `-5`, the image + will scroll one **frame** at a time. (A frame is a part of the + image. It is a square with five LEDs on a side). This is + useful for **animation**. -### ~hide +* ``interval (ms)`` is a [number](/reference/types/number) that means + how many milliseconds to wait before scrolling the amount that + ``offset`` says. (1000 milliseconds is one second.) The bigger you + make this number, the slower the image will scroll. -``` -let img = images.createImage(` -. . # . . . # # # . . # # # . -. . # . . . . . # . . . . # . -. . # . . . . # . . . # # # . -. . # . . . # . . . . . . # . -. . # . . . # # # . . # # # . -`) -``` +### Example -### ~ +This program scrolls an image of two arrows five LEDs at a time, +with a pause of 200 milliseconds between each time it scrolls. +Because each frame is five LEDs wide, that means this program +will look like it's animating one arrow flipping and flopping. +Of course, you can use any two frames you want instead. -To scroll an image 1 column at a time to the right: -``` -img.scrollImage(1, 1000) -``` - -To scroll an image 5 columns at a time (skip from frame to frame): - -``` -img.scrollImage(5, 1000) -``` - -To scroll an image 1 column at a time to the left: - -``` -img.scrollImage(-1, 500) -``` - -### Example: scroll through frames - -This example creates an image with 3 frames, then scrolls through the 3 frames: - -``` -img = images.createImage(` -. . # . . . # # # . . # # # . -. . # . . . . . # . . . . # . -. . # . . . . # . . . # # # . -. . # . . . # . . . . . . # . -. . # . . . # # # . . # # # . -`) -img.showImage(0) -img.scrollImage(5, 1000) +```blocks +let arrows = images.createBigImage(` + . . # . . . . # . . + . # # # . . . # . . + # . # . # # . # . # + . . # . . . # # # . + . . # . . . . # . . + `); +basic.forever(() => { + arrows.scrollImage(5, 200); +}); ``` ### See also diff --git a/docs/reference/images/show-image.md b/docs/reference/images/show-image.md index 753db150..8ce2f38c 100644 --- a/docs/reference/images/show-image.md +++ b/docs/reference/images/show-image.md @@ -1,51 +1,42 @@ # Show Image -The show image function. - -Show an [Image](/reference/images/image) on the [LED screen](/device/screen), followed by a 400ms pause. - -``` -export function showImage(_this: micro_bit.Image, xOffset: number) -``` +Show an [image](/reference/images/image) (picture) on the +[LED screen](/device/screen). After the micro:bit shows an image, it +will pause for 400 milliseconds (1000 milliseconds is one second). ### Parameters -* x offset - [Number](/reference/types/number); the horizontal starting point of an image; use 0 for the first frame of the image, 5 for the second frame of the image, 10 for the third frame and so on. +* an [image](/reference/images/image) (picture). It is usually a square with five LEDs on a side, but it might be wider. +* a [number](/reference/types/number) that says how many LEDs from the left of the picture the micro:bit should start. `0` means start at the first **frame** of the picture, `5` means start at the second frame, `10` means start at the third, and so on. -### Create image and show image +### Example: Flip-flopping arrow -Use the [image editor](/reference/images/image) to create images using the [create image](/reference/images/create-image) function, and then use `show image` like this: +This program makes a big image with a frame of an arrow pointing up, +and a frame of an arrow pointing down. If you press button `A`, the +program will use ``show image`` to show the arrow pointing up. (It +starts `0` LEDs from the left in the big image.) If you press button +`B`, the program will use ``show image`` to show the arrow pointing +down, which starts `5` LEDs from the left. -``` -let img = images.createImage(` -. . # . . -. # . # . -. . # . . -. # . # . -. . # . . -`) -img.showImage(0) -``` - -### Example: display numbers 1-5 - -The following example creates an image with 5 frames and then uses a [for loop](/blocks/loops/for) to show each frame on the screen: - -``` -let img2 = images.createImage(` -. . # . . . # # # # . # # # . . . . # . . # # # . -. # # . . . . . . # . . . # . . . # # . . # . . . -. . # . . . . . # . . . # . . . # # # # . # # # . -. . # . . . . # . . . . . # . . . . # . . . . # . -. . # . . . # # # # . # # # . . . . # . . # # # . -`) -for (let i = 0; i < 5; i++) { - img2.showImage(i * 5) - basic.pause(1000) -} +```blocks +let arrows = images.createBigImage(` + . . # . . . . # . . + . # # # . . . # . . + # . # . # # . # . # + . . # . . . # # # . + . . # . . . . # . . + `); +input.onButtonPressed(Button.A, () => { + arrows.showImage(0); +}); +input.onButtonPressed(Button.B, () => { + arrows.showImage(5); +}); ``` ### See also -[show animation](/reference/basic/show-animation), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image) - +[Getting Started](/getting-started), [image](/reference/images/image), +[create image](/reference/images/create-image), +[create big image](/reference/images/create-big-image), +[scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation) diff --git a/docs/reference/images/width.md b/docs/reference/images/width.md index ed980fe3..41d1f6e0 100644 --- a/docs/reference/images/width.md +++ b/docs/reference/images/width.md @@ -56,5 +56,5 @@ for (let i = 0; i < img2.width() / 5; i++) { ### See also -[show image](/reference/images/show-image), [image](/reference/image/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation) +[show image](/reference/images/show-image), [image](/reference/images/image), [create image](/reference/images/create-image), [scroll image](/reference/images/scroll-image), [show animation](/reference/basic/show-animation) diff --git a/docs/reference/radio/send-value.md b/docs/reference/radio/send-value.md index 63a432bc..a9ad5a83 100644 --- a/docs/reference/radio/send-value.md +++ b/docs/reference/radio/send-value.md @@ -1,11 +1,11 @@ -# Send Number +# Send Value -Broadcast a (name,number) pair to other micro:bits connected via ``radio``. +Send a [string]() and [number]() together by ``radio`` to other micro:bits. ### Parameters -* name - a string to send -* num - a number to send. +* a [string](/reference/types/string) to send by radio +* a [number](/reference/types/number) to send by radio ### Simulator @@ -13,16 +13,29 @@ This function only works on the micro:bit, not in browsers. ### Example: Broadcasting acceleration -This example broadcasts the value of your micro:bit's ``acceleration`` in the `x` direction -(left and right) to other micro:bits. -This kind of program might be useful in a model car or model rocket. +This program sends your micro:bit's **acceleration** (amount it is +speeding up or slowing down) in the `x` direction (left and right) to +other micro:bits. This kind of program might be useful in a model car +or model rocket. ```blocks +radio.setGroup(99) input.onButtonPressed(Button.A, () => { radio.sendValue("acc",input.acceleration(Dimension.X)) }) ``` +This program receives the string and number sent by the last program. +Then it shows them on the LED screen. + +```blocks +radio.setGroup(99) +radio.onDataReceived(() => { + basic.showString(radio.receiveString()); + basic.showNumber(radio.receiveNumber()); +}); +``` + ### See also [receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received) diff --git a/docs/reference/types/number.md b/docs/reference/types/number.md index 970416ae..8d7cde64 100644 --- a/docs/reference/types/number.md +++ b/docs/reference/types/number.md @@ -57,7 +57,7 @@ let brightness = led.brightness() ### Math functions -The [math library](/reference/math) includes math related functions. +The [math library](/blocks/math) includes math related functions. For example, the `absolute` function returns the returns the absolute value of input parameter `x`: ```blocks diff --git a/docs/static/mb/projects/a1-display.png b/docs/static/mb/projects/a1-display.png index 55da986b..c835b4fa 100644 Binary files a/docs/static/mb/projects/a1-display.png and b/docs/static/mb/projects/a1-display.png differ diff --git a/docs/static/mb/projects/a10-watch.png b/docs/static/mb/projects/a10-watch.png index a27b1891..9781b759 100644 Binary files a/docs/static/mb/projects/a10-watch.png and b/docs/static/mb/projects/a10-watch.png differ diff --git a/docs/static/mb/projects/a2-buttons.png b/docs/static/mb/projects/a2-buttons.png index 469445ab..ed882419 100644 Binary files a/docs/static/mb/projects/a2-buttons.png and b/docs/static/mb/projects/a2-buttons.png differ diff --git a/docs/static/mb/projects/a3-pins.png b/docs/static/mb/projects/a3-pins.png index 55fa7aad..4ca19601 100644 Binary files a/docs/static/mb/projects/a3-pins.png and b/docs/static/mb/projects/a3-pins.png differ diff --git a/docs/static/mb/projects/a4-motion.png b/docs/static/mb/projects/a4-motion.png index 7e9e31f3..10ea6a2d 100644 Binary files a/docs/static/mb/projects/a4-motion.png and b/docs/static/mb/projects/a4-motion.png differ diff --git a/docs/static/mb/projects/a5-compass.png b/docs/static/mb/projects/a5-compass.png index 644008a9..3d7f8655 100644 Binary files a/docs/static/mb/projects/a5-compass.png and b/docs/static/mb/projects/a5-compass.png differ diff --git a/docs/static/mb/projects/a6-music.png b/docs/static/mb/projects/a6-music.png index 2eaa244d..0ec2718c 100644 Binary files a/docs/static/mb/projects/a6-music.png and b/docs/static/mb/projects/a6-music.png differ diff --git a/docs/static/mb/projects/a7-conductive.png b/docs/static/mb/projects/a7-conductive.png index 4ea87138..3ae20a63 100644 Binary files a/docs/static/mb/projects/a7-conductive.png and b/docs/static/mb/projects/a7-conductive.png differ diff --git a/docs/static/mb/projects/a8-network.png b/docs/static/mb/projects/a8-network.png index 6849a27e..9ac1f2f5 100644 Binary files a/docs/static/mb/projects/a8-network.png and b/docs/static/mb/projects/a8-network.png differ diff --git a/docs/static/mb/projects/a9-radio.png b/docs/static/mb/projects/a9-radio.png index ff3b269e..80d48107 100644 Binary files a/docs/static/mb/projects/a9-radio.png and b/docs/static/mb/projects/a9-radio.png differ diff --git a/libs/microbit-radio/radio.cpp b/libs/microbit-radio/radio.cpp index ab682448..e41d6d9c 100644 --- a/libs/microbit-radio/radio.cpp +++ b/libs/microbit-radio/radio.cpp @@ -214,7 +214,7 @@ namespace radio { /** * Change the output power level of the transmitter to the given value. - * @param power a value in the range 0..7, where 0 is the lowest power and 7 is the highest, 7 eg + * @param power a value in the range 0..7, where 0 is the lowest power and 7 is the highest. eg: 7 */ //% help=radio/set-transmit-power //% weight=9 diff --git a/libs/microbit-radio/shims.d.ts b/libs/microbit-radio/shims.d.ts index 4e65dd5b..2391ebc4 100644 --- a/libs/microbit-radio/shims.d.ts +++ b/libs/microbit-radio/shims.d.ts @@ -94,7 +94,7 @@ declare namespace radio { /** * Change the output power level of the transmitter to the given value. - * @param power a value in the range 0..7, where 0 is the lowest power and 7 is the highest, 7 eg + * @param power a value in the range 0..7, where 0 is the lowest power and 7 is the highest. eg: 7 */ //% help=radio/set-transmit-power //% weight=9 diff --git a/libs/microbit/_locales/ar/microbit-strings.json b/libs/microbit/_locales/ar/microbit-strings.json index 4d580509..4ab753b8 100644 --- a/libs/microbit/_locales/ar/microbit-strings.json +++ b/libs/microbit/_locales/ar/microbit-strings.json @@ -1,92 +1,240 @@ { "Math.randomBoolean":"يقوم بإنشاء قيمة 'صحيح' أو 'false' عشوائياً، تماما مثل التقليب عمله.", + "Math.randomBoolean|block":"اختيار عشوائي true أو false", + "Math|block":"الرياضيات", "String.fromCharCode":"جعل سلسلة من رمز الحرف ASCII معطى.", + "String.fromCharCode|block":"النص من حرف رمز %code", + "String|block":"السلسلة", "basic":"يوفر الوصول إلى الوظيفة الأساسية الصغرى: بت.", "basic.clearScreen":"إيقاف تشغيل كافة المصابيح", + "basic.clearScreen|block":"مسح الشاشة", "basic.forever":"تكرار التعليمات البرمجية إلى الأبد في الخلفية. في كل تكرار، يسمح رموز أخرى لتشغيل.", + "basic.forever|block":"إلى الأبد", "basic.pause":"إيقاف مؤقت للوقت المحدد بالمللي ثانية", + "basic.pause|block":"إيقاف %pause (مللي ثانية)", + "basic.pause|param|ms":"كم من الوقت للتوقف، على سبيل المثال: 100، 200، 500، 1000، 2000", "basic.plotLeds":"يرسم صورة على شاشة LED.", + "basic.plotLeds|param|leds":"نمط من المصابيح لتشغيل\/إيقاف تشغيل", "basic.showAnimation":"ويبين تسلسل الشاشات LED كالرسوم متحركة.", + "basic.showAnimation|param|interval":"الوقت بالمللي ثانية بين كل رسم", + "basic.showAnimation|param|leds":"نمط من المصابيح لتشغيل\/إيقاف تشغيل", "basic.showLeds":"يرسم صورة على شاشة LED.", + "basic.showLeds|block":"إظهار المصابيح", + "basic.showLeds|param|interval":"الوقت بالمللي ثانية وقفه بعد الرسم", + "basic.showLeds|param|leds":"نمط الصمام لتشغيل\/إيقاف تشغيل", "basic.showNumber":"قم بالتمرير رقم على الشاشة. إذا كان العدد يناسب على الشاشة (أي هو رقم واحد)، لا يتم تمرير.", + "basic.showNumber|block":"show|number %number", + "basic.showNumber|param|interval":"سرعة التمرير؛ على سبيل المثال: 150، 200-100، 100", "basic.showString":"عرض النص على الشاشة، حرف واحد في كل مرة. إذا كانت السلسلة يناسب على الشاشة (أي حرف واحد)، لا يتم تمرير.", + "basic.showString|block":"show|string %text", + "basic.showString|param|interval":"طريقة سريعة لتحويل الأحرف؛ على سبيل المثال: 150، 200-100، 100", + "basic.showString|param|text":"النص للتمرير على الشاشة، على سبيل المثال: \"مرحبا!\"", + "basic|block":"الأساسية", "control":"المرافق وقت التشغيل والحدث.", "control.inBackground":"الجداول الزمنية للتعليمات البرمجية التي يتم تشغيلها في الخلفية.", + "control.inBackground|block":"تشغيل في الخلفية", "control.reset":"يعيد تعيين الصغير: بت ال بي بي سي.", + "control.reset|block":"إعادة تعيين", + "control|block":"التحكم", "game":"محرك لعبة واحدة تقودها العفريت", "game.addScore":"إضافة نقاط إلى النتيجة الحالية", + "game.addScore|block":"تغيير درجة by|%points", + "game.addScore|param|points":"كمية من النقاط لتغيير، على سبيل المثال: 1", "game.gameOver":"يعرض لعبة الرسوم المتحركة.", + "game.gameOver|block":"انتهت اللعبة", "game.score":"يحصل على النتيجة الحالية", + "game.score|block":"نقاط", "game.setScore":"تعيين القيمة إلى النتيجة الحالية", + "game.setScore|param|value":"تودو", "game.startCountdown":"بدء تشغيل جهاز ضبط وقت العد التنازلي لعبة", + "game.startCountdown|block":"بدء تشغيل countdown| (مللي ثانية) %duration", + "game.startCountdown|param|ms":"مدة العد التنازلي في ميلي ثانية، على سبيل المثال: 10000", + "game|block":"لعبة", "images":"إنشاء والتلاعب وعرض الصور الصمام.", "images.createBigImage":"يقوم بإنشاء صورة مع إطارات 2.", + "images.createBigImage|block":"إنشاء صورة كبيرة", "images.createImage":"يقوم بإنشاء صورة التي تناسبها على شاشة LED.", + "images.createImage|block":"إنشاء الصورة", + "images|block":"الصور", "input":"الأحداث والبيانات من أجهزة الاستشعار", "input.acceleration":"الحصول على قيمة التسارع في المجلس الملي-جرافيتيس (عندما يتم إرساء المجلس شقة مع الشاشة حتى, x = 0, y = 0 و z = 1024)", + "input.acceleration|block":"|%NAME التسارع (mg)", + "input.acceleration|param|dimension":"تودو", "input.buttonIsPressed":"الحصول على حالة زر (ضغط أو لا) '' '' و '' ب ''.", + "input.buttonIsPressed|block":"button|%NAME|is الضغط", "input.calibrate":"معايرة بوصلة عفا عليها الزمن، والتلقائي.", "input.compassHeading":"الحصول على عنوان البوصلة البوصلة الحالية في درجات.", + "input.compassHeading|block":"بوصلة العنوان (°)", "input.lightLevel":"يقرأ مستوى الضوء المطبقة على شاشة LED في طائفة من '' 0 '' (الظلام) إلى 255 '' '' مشرق.", + "input.lightLevel|block":"مستوى الضوء", "input.magneticForce":"الحصول على قيمة القوة المغناطيسية في '' الصغرى-Teslas '' ('' µT ''). هذه الوظيفة غير معتمدة في المحاكاة.", + "input.magneticForce|block":"القوة المغناطيسية (µT) |%NAME", + "input.magneticForce|param|dimension":"تودو", "input.onButtonPressed":"القيام بشيء عند الضغط على زر ('' '' أو '' ب '' أو كلا '' أ + ب '')", + "input.onButtonPressed|block":"على button|%NAME|pressed", + "input.onButtonPressed|param|body":"تودو", + "input.onButtonPressed|param|button":"تودو", "input.onGesture":"وتولى تشغيل التعليمات البرمجية عند هو مواجهة الشاشة.", + "input.onGesture|block":"على |%NAME", + "input.onGesture|param|body":"تودو", "input.onLogoDown":"وتولى تشغيل التعليمات البرمجية عند الشعار وتتجه نزولا والمجلس بشكل عمودي.", + "input.onLogoDown|param|body":"تودو", "input.onLogoUp":"وتولى تشغيل التعليمات البرمجية عند الشعار وتتجه صعودا والمجلس بشكل عمودي.", + "input.onLogoUp|param|body":"تودو", "input.onPinPressed":"تفعل شيئا عند الضغط على رقم التعريف الشخصي ('' P0 '' أو '' P1 '' أو كلا '' P2 '').", + "input.onPinPressed|block":"على pin|%NAME|pressed", + "input.onPinPressed|param|body":"تودو", + "input.onPinPressed|param|name":"تودو", "input.onScreenDown":"وتولى تشغيل التعليمات البرمجية عند هو أسفل الشاشة.", + "input.onScreenDown|param|body":"تودو", "input.onScreenUp":"وتولى تشغيل التعليمات البرمجية عند هو مواجهة الشاشة.", + "input.onScreenUp|param|body":"تودو", "input.onShake":"وتولى تشغيل التعليمات البرمجية عند هو هز الجهاز.", + "input.onShake|param|body":"تودو", "input.pinIsPressed":"الحصول على دولة طرف (ضغط أو لا). ويتطلب عقد الأرض من أجل إغلاق الدائرة.", + "input.pinIsPressed|block":"pin|%NAME|is الضغط", + "input.pinIsPressed|param|name":"دبوس المستخدمة للكشف عن لمسة", "input.rotation":"الملعب للجهاز، وتناوب على طول '' المحور ''، بدرجات.", + "input.rotation|block":"|%NAME دوران (°)", + "input.rotation|param|kind":"تودو", "input.runningTime":"يحصل على عدد المللي ثانية المنقضية منذ السلطة في.", + "input.runningTime|block":"إدارة الوقت (مللي ثانية)", "input.setAccelerometerRange":"يعين نطاق العينة التسارع في جاذبيات.", + "input.setAccelerometerRange|block":"تعيين نطاق % accelerometer|range", + "input.setAccelerometerRange|param|range":"قيمة وصف قوتها القصوى لقياس التسارع", "input.temperature":"يحصل على درجة حرارة مئوية درجات (درجة مئوية).", + "input.temperature|block":"درجة الحرارة (درجة مئوية)", + "input|block":"الإدخال", "led":"التحكم في شاشة LED.", "led.brightness":"الحصول على سطوع الشاشة من 0 (إيقاف) إلى 255 (مشرق كامل).", + "led.brightness|block":"سطوع", "led.fadeIn":"يتلاشى في العرض على الشاشة.", + "led.fadeIn|param|ms":"تودو", "led.fadeOut":"إخفاء مستوى سطوع الشاشة.", + "led.fadeOut|param|ms":"تودو", "led.plot":"قم بتشغيل باستخدام الصمام المحدد x, y إحداثيات (س الأفقي، ص العمودي). (0, 0) هو أعلى اليسار.", "led.plotAll":"تشغيل كافة المصابيح", "led.plotBarGraph":"يعرض رسم بياني شريطي عمودي استناداً إلى 'قيمة' والقيمة 'عالية'.\nإذا كان 'عالية' هو 0، ويحصل ضبط التخطيط تلقائياً.", + "led.plotBarGraph|block":"رسم بياني شريطي من الإقلاع القيمة % إلى %high", + "led.plotBarGraph|param|high":"الحد الأقصى للقيمة. إذا كان 0, الحد الأقصى للقيمة المعدلة تلقائياً، على سبيل المثال: 0", + "led.plotBarGraph|param|value":"القيمة الحالية الأرض", + "led.plot|block":"plot|x %x|y %y", + "led.plot|param|x":"تودو", + "led.plot|param|y":"تودو", "led.point":"الحصول على حالة تشغيل\/إيقاف استخدام الصمام المحدد x, y إحداثيات. (0, 0) هو أعلى اليسار.", + "led.point|block":"point|x %x|y %y", + "led.point|param|x":"تودو", + "led.point|param|y":"تودو", "led.screenshot":"تأخذ لقطة للشاشة LED وترجع صورة.", "led.setBrightness":"تعيين سطوع الشاشة من 0 (إيقاف) إلى 255 (مشرق كامل).", + "led.setBrightness|block":"قم بتعيين القيمة % السطوع", + "led.setBrightness|param|value":"قيمة السطوع، على سبيل المثال: 255، 127، 0", "led.setDisplayMode":"تعيين وضع العرض بين الأسود والأبيض واللون الرمادي لجعلها المصابيح.", + "led.setDisplayMode|param|mode":"تودو", "led.stopAnimation":"إلغاء الحركة الحالية ومسح أخرى انتظارا للرسوم المتحركة.", + "led.stopAnimation|block":"وقف الرسوم المتحركة", "led.toggle":"يبدل بكسل خاص", "led.toggleAll":"عكس العرض LED الحالية", + "led.toggle|param|x":"تودو", + "led.toggle|param|y":"تودو", "led.unplot":"إيقاف استخدام الصمام المحدد x, y إحداثيات (س الأفقي، ص العمودي). (0, 0) هو أعلى اليسار.", + "led.unplot|block":"unplot|x %x|y %y", + "led.unplot|param|x":"تودو", + "led.unplot|param|y":"تودو", + "led|block":"شاشة", "music":"جيل نغمات الموسيقى عن طريق الرقم السري '''' P0 ''.", "music.beat":"إرجاع المدة للفوز في ميلي ثانية", + "music.beat|block":"%fraction|beat", "music.changeTempoBy":"تغيير الإيقاع بالمبلغ المحدد", + "music.changeTempoBy|block":"تغيير الإيقاع بواسطة (bpm) | قيمة %", + "music.changeTempoBy|param|bpm":"التغيير في دقات في الدقيقة الواحدة للايقاع، على سبيل المثال: 20", "music.noteFrequency":"يحصل على تكرار الملاحظة.", + "music.noteFrequency|block":"%note", + "music.noteFrequency|param|name":"ملاحظة اسم", "music.playTone":"يلعب نغمة عن طريق الرقم السري '''' P0 '' لمدة معينة.", + "music.playTone|block":"play|tone %note = device_note|for %duration = device_beat", + "music.playTone|param|frequency":"الملعب لهجة للعب في هرتز (هرتز)", + "music.playTone|param|ms":"مدة نغمة في ميلي ثانية (مللي ثانية)", "music.rest":"تقع (يلعب شيئا) لفترة زمنية محددة عن طريق الرقم السري '''' P0 ''.", + "music.rest|block":"|%duration بقية (مللي ثانية) = device_beat", + "music.rest|param|ms":"مدة الراحة في ميلي ثانية (مللي ثانية)", "music.ringTone":"يلعب نغمة عن طريق الرقم السري '''' P0 ''.", + "music.ringTone|block":"عصابة لهجة (هرتز) |%note = device_note", + "music.ringTone|param|frequency":"الملعب لهجة للعب في هرتز (هرتز)", "music.setTempo":"يحدد وتيرة إلى المبلغ المحدد", + "music.setTempo|block":"ضبط الإيقاع (نبضة في الدقيقة) | قيمة %", + "music.setTempo|param|bpm":"يدق على وتيرة جديدة في كل دقيقة، على سبيل المثال: 120", "music.tempo":"تقوم بإرجاع الإيقاع في نبضة في الدقيقة. الإيقاع هو السرعة (bpm = نبضة في الدقيقة) في اللعب وتلاحظ فيه. أكبر قيمة الإيقاع، سيتم تشغيل أسرع وتلاحظ.", + "music.tempo|block":"الإيقاع (نبضة في الدقيقة)", + "music|block":"الموسيقى", "pins":"التحكم في التيارات في دبابيس للإشارات التناظرية\/الرقمية، الماكينات، i2c،...", "pins.analogPitch":"يبث إشارات تحوير (بوم) عرض نبض بدبوس الملعب الحالي. استخدام 'النظير تعيين pin الملعب' لتعريف pin في الملعب.", + "pins.analogPitch|param|frequency":"تودو", + "pins.analogPitch|param|ms":"تودو", "pins.analogReadPin":"قراءة القيمة موصل النظير، وهذا هو، كقيمة بين 0 و 1023 وتتألف.", + "pins.analogReadPin|block":"%name read|pin التناظرية", + "pins.analogReadPin|param|name":"دبوس الكتابة إلى", "pins.analogSetPeriod":"تكوين تحوير عرض النبضة (PWM) التناظرية المخرجات إلى قيمة معينة في * * ميكرو * * أو '' 1\/1000 ميلي ثانية.\nإذا لم يتم تكوين هذا الدبوس تمثيلي الإخراج (باستخدام 'الكتابة التناظرية دبوس')، قد العملية أي تأثير.", + "pins.analogSetPeriod|block":"تعيين النظير period|pin %pin|to مايكروون % (المايكروثانيه)", + "pins.analogSetPeriod|param|micros":"الفترة في الدقيقة ثانية. على سبيل المثال: 20000", + "pins.analogSetPeriod|param|name":"دبوس التناظرية لتعيين الفترة إلى", "pins.analogSetPitchPin":"تعيين رقم pin المستخدم عند استخدام 'دبابيس-> التناظرية في الملعب'.", + "pins.analogSetPitchPin|param|name":"تودو", "pins.analogWritePin":"تعيين القيمة رابط تمثيلي. يجب أن تتألف القيمة بين 0 و 1023.", + "pins.analogWritePin|block":"القيمة % %name|to write|pin التناظرية", + "pins.analogWritePin|param|name":"اسم دبوس الكتابة إلى", + "pins.analogWritePin|param|value":"قيمة لكتابة رقم التعريف الشخصي بين '' 0 '' و '' 1023 ''. على سبيل المثال: 1023, 0", "pins.digitalReadPin":"قراءة المحدد رقم pin أو موصل أما 0 أو 1", + "pins.digitalReadPin|block":"read|pin رقمي %name", + "pins.digitalReadPin|param|name":"رقم التعريف الشخصي لقراءة من", "pins.digitalWritePin":"تعيين قيمة رقم pin أو الرابط إلى 0 أو 1.", + "pins.digitalWritePin|block":"القيمة % %name|to write|pin الرقمي", + "pins.digitalWritePin|param|name":"دبوس الكتابة إلى", + "pins.digitalWritePin|param|value":"قيمة لتعيين رقم pin، 1 على سبيل المثال، 0", "pins.i2cReadNumber":"قراءة رقم واحد من عنوان I2C 7 بت.", + "pins.i2cReadNumber|block":"i2c قراءة عنوان number|at %address|of الشكل %format = i2c_sizeof", "pins.i2cWriteNumber":"كتابة رقم واحد لعنوان I2C 7 بت.", + "pins.i2cWriteNumber|block":"i2c يكتب عنوان number|at %address|with % قيمة value|of %format الشكل = i2c_sizeof", "pins.map":"إعادة تعيين عدد من مجموعة واحدة إلى أخرى. فالحصول على تعيين قيمة '' من منخفضة '' إلى '' إلى انخفاض ''، قيمة '' من السامي '' إلى '' إلى ارتفاع ''، قيم الفترات الفاصلة بين القيم بينهما، إلخ.", + "pins.map|block":"خريطة % value|from %fromLow|from منخفضة %fromHigh|to ارتفاع منخفض %toLow|to عالية %toHigh", + "pins.map|param|fromHigh":"العليا ملزمة للنطاق الحالي للقيمة، على سبيل المثال: 1023", + "pins.map|param|fromLow":"الحد الأدنى للنطاق الحالي للقيمة", + "pins.map|param|toHigh":"الحد الأعلى المستهدفة القيمة تتراوح، على سبيل المثال: 4", + "pins.map|param|toLow":"الحد الأدنى للنطاق المستهدف للقيمة", + "pins.map|param|value":"قيمة للتعيين في نطاقات", "pins.onPulsed":"تكوين هذا الرقم السري لأحد مدخلات رقمية، وينشئ الأحداث حيث الطابع الزمني هو المدة التي كان هذا الرقم '' عالية '' أو '' منخفضة ''.", + "pins.onPulsed|block":"on|pin %pin|pulsed %pulse", "pins.pulseDuration":"يحصل على مدة نبض الماضي في مايكرو-ثانية. يجب أن يتم استدعاء هذه الدالة من معالج '' أونبولسيد ''.", + "pins.pulseDuration|block":"مدة النبضة (المايكروثانيه)", "pins.servoSetPulse":"تكوين هذا دبوس آيو كناتج التناظرية\/بوم وتكوين الفترة بأن يكون 20 مللي ثانية، وتعيين عرض النبض، استناداً إلى القيمة التي تعطي * * ميكرو * * أو '' 1\/1000 ميلي ثانية.", + "pins.servoSetPulse|block":"تعيين مضاعفات pulse|pin value|to (المايكروثانيه) % % مايكروون", + "pins.servoSetPulse|param|micros":"مدة النبضة في الدقيقة ثانية، على سبيل المثال: 1500", + "pins.servoSetPulse|param|name":"اسم دبوس", "pins.servoWritePin":"تكتب قيمة إلى مضاعفات، السيطرة الرمح تبعاً لذلك. في مضاعفات قياسية، سيؤدي هذا إلى تعيين زاوية الرمح (بالدرجات)، تتحرك الرمح لهذا التوجه. في مضاعفات تناوب مستمر، وهذا سيتم تعيين سرعة الماكينة (مع '' 0 '''' بسرعة كاملة في اتجاه واحد، '' 180 '' يجري كامل السرعة في أخرى، وقيمة قرب '' 90 '' يجري أي حركة).", + "pins.servoWritePin|block":"مضاعفات write|pin %name|to القيمة %", + "pins.servoWritePin|param|name":"دبوس الكتابة إلى", + "pins.servoWritePin|param|value":"زاوية أو التناوب سرعة، على سبيل المثال: 180، 90، 0", "pins.setPull":"تكوين السحب من هذا الرقم.", + "pins.setPull|block":"تعيين pull|pin %pin|to %pull", + "pins.setPull|param|name":"رقم التعريف الشخصي لتعيين وضع الانسحاب في", + "pins.setPull|param|pull":"أحد تكوينات السحب مبيد: بولوب، المنسدلة، بولنوني ", + "pins|block":"دبابيس", "serial":"قراءة وكتابة البيانات عبر اتصال تسلسلي.", "serial.readLine":"يقرأ سطر من النص من المنفذ التسلسلي.", + "serial.readLine|block":"قراءة سطر للمسلسل", "serial.redirect":"بشكل حيوي تكوين مثيل تسلسلي استخدام دبابيس خلاف أوسبتكس واسبر.", + "serial.redirect|block":"إعادة توجيه المسلسل to| TX %tx| RX % rx|at % معدل معدل الباود", + "serial.redirect|param|rx":"دبوس الاستقبال الجديدة", + "serial.redirect|param|tx":"دبابيس الإرسال الجديدة", "serial.writeLine":"طباعة سطر من النص للمسلسل", + "serial.writeLine|block":"serial|write خط %text", "serial.writeNumber":"طباعة قيمة رقمية للمسلسل", + "serial.writeNumber|block":"قيمة % رقم serial|write", "serial.writeString":"يرسل جزء من النص من خلال اتصال تسلسلي.", - "serial.writeValue":"يكتب '' الاسم: قيمة '' زوج الخط للمسلسل." + "serial.writeString|block":"كتابة المسلسل سلسلة %text", + "serial.writeValue":"يكتب '' الاسم: قيمة '' زوج الخط للمسلسل.", + "serial.writeValue|block":"serial|write قيمة %name| = القيمة %", + "serial.writeValue|param|name":"اسم القيمة الدفق، على سبيل المثال: x", + "serial.writeValue|param|value":"يكتب", + "serial|block":"مصدر الاتصال" } \ No newline at end of file diff --git a/libs/microbit/_locales/fr/microbit-strings.json b/libs/microbit/_locales/fr/microbit-strings.json index fbbac620..b0424061 100644 --- a/libs/microbit/_locales/fr/microbit-strings.json +++ b/libs/microbit/_locales/fr/microbit-strings.json @@ -1,92 +1,240 @@ { "Math.randomBoolean":"Génère une valeur « true » ou « false » au hasard, tout comme le retournement d’une pièce de monnaie.", + "Math.randomBoolean|block":"choisir au hasard vrai ou faux", + "Math|block":"Math", "String.fromCharCode":"Faire une chaîne de la donnée code de caractères ASCII.", + "String.fromCharCode|block":"texte de char code %code", + "String|block":"Chaîne", "basic":"Permet d'accéder aux fonctionnalités de base micro : bit.", "basic.clearScreen":"Désactiver toutes les LEDs", + "basic.clearScreen|block":"effacer l’écran", "basic.forever":"Répète le code pour toujours en arrière-plan. À chaque itération, permet aux autres codes d'exécuter.", + "basic.forever|block":"pour toujours", "basic.pause":"Pause pendant la durée spécifiée en millisecondes", + "basic.pause|block":"pause (ms) %pause", + "basic.pause|param|ms":"Combien de temps pour faire une pause pour, par exemple: 100, 200, 500, 1000, 2000", "basic.plotLeds":"Dessine une image sur l'écran LED.", + "basic.plotLeds|param|leds":"modèle de LED à allumer\/éteindre", "basic.showAnimation":"Montre une séquence d'écrans LED comme une animation.", + "basic.showAnimation|param|interval":"temps en millisecondes entre chaque rafraîchissement", + "basic.showAnimation|param|leds":"modèle de LED à allumer\/éteindre", "basic.showLeds":"Dessine une image sur l'écran LED.", + "basic.showLeds|block":"montrer les leds", + "basic.showLeds|param|interval":"temps en millisecondes pour faire une pause après dessin", + "basic.showLeds|param|leds":"le modèle de LED pour activer\/désactiver", "basic.showNumber":"Mettez en surbrillance un numéro sur l'écran. Si le numéro s'inscrit sur l'écran (c'est-à-dire un seul chiffre), ne défilent pas.", + "basic.showNumber|block":"montrer|numéro %number", + "basic.showNumber|param|interval":"Vitesse de défilement ; par exemple: -100, 200, 100, 150", "basic.showString":"Afficher du texte à l'écran, un caractère à la fois. Si la chaîne s'inscrit sur l'écran (c'est-à-dire une lettre), ne défile pas.", + "basic.showString|block":"Show|String %text", + "basic.showString|param|interval":"quelle vitesse de déplacement des personnages ; par exemple: -100, 200, 100, 150", + "basic.showString|param|text":"le texte à faire défiler sur l’écran, par exemple: « Bonjour! »", + "basic|block":"base", "control":"Utilitaires d'exécution et événements.", "control.inBackground":"Horaires du code qui s'exécutent en arrière-plan.", + "control.inBackground|block":"exécuter en arrière-plan", "control.reset":"Réinitialise le BBC micro : bit.", + "control.reset|block":"remise à zéro", + "control|block":"contrôle", "game":"Un moteur de jeu unique-LED sprite", "game.addScore":"Ajoute des points pour le score actuel", + "game.addScore|block":"changer le score par|%points", + "game.addScore|param|points":"nombre de points à changer, par exemple: 1", "game.gameOver":"Affiche un jeu au dessus de l'animation.", + "game.gameOver|block":"fin du jeu", "game.score":"Obtient le score actuel", + "game.score|block":"score", "game.setScore":"Définit la valeur actuelle de la partition", + "game.setScore|param|value":"TODO", "game.startCountdown":"Commence un compte à rebours jeu", + "game.startCountdown|block":"commencer compte à rebours|(ms) %duration", + "game.startCountdown|param|ms":"durée du compte à rebours en millisecondes, par exemple: 10000", + "game|block":"jeu", "images":"Création, manipulation et affichage d'images LED.", "images.createBigImage":"Crée une image avec 2 images.", + "images.createBigImage|block":"créer grande image", "images.createImage":"Crée une image qui s'adapte à l'écran LED.", + "images.createImage|block":"créer image", + "images|block":"images", "input":"Événements et des données provenant de capteurs", "input.acceleration":"Obtenir la valeur de l'accélération en milli-gravitys (lorsque le jury pose plat avec l'écran vers le haut, x = 0, y = 0 et z =-1024)", + "input.acceleration|block":"accélération (mg) |%NAME", + "input.acceleration|param|dimension":"TODO", "input.buttonIsPressed":"Obtenir l'état du bouton (pressé ou non) pour '' A'' et '' B''.", + "input.buttonIsPressed|block":"button|%NAME|est pressé", "input.calibrate":"Obsolète, boussole de calibrage est automatique.", "input.compassHeading":"Obtenir le cap compas boussole actuel en degrés.", + "input.compassHeading|block":"Compas de rubrique (°)", "input.lightLevel":"Lit le niveau de lumière appliqué à l'écran LED dans une gamme de '' 0'' (noir) à 255 '''' lumineux.", + "input.lightLevel|block":"niveau d’intensité lumineuse", "input.magneticForce":"Obtenir la valeur de la force magnétique dans '' micro-Teslas'' ('' µT''). Cette fonction n'est pas pris en charge dans le simulateur.", + "input.magneticForce|block":"force magnétique (µT) |%NAME", + "input.magneticForce|param|dimension":"TODO", "input.onButtonPressed":"Faire quelque chose quand vous appuyez sur un bouton ('' A'', '' B'' ou les deux '' A + B'')", + "input.onButtonPressed|block":"sur button|%NAME|pressed", + "input.onButtonPressed|param|body":"TODO", + "input.onButtonPressed|param|button":"TODO", "input.onGesture":"Attache le code à exécuter lorsque l'écran vers le haut.", + "input.onGesture|block":"sur |%NAME", + "input.onGesture|param|body":"TODO", "input.onLogoDown":"Attache le code à exécuter lorsque le logo est orienté vers le bas et le jury est vertical.", + "input.onLogoDown|param|body":"TODO", "input.onLogoUp":"Attache le code à exécuter lorsque le logo est orienté vers le haut et le jury est vertical.", + "input.onLogoUp|param|body":"TODO", "input.onPinPressed":"Faire quelque chose lorsque vous appuyez sur une broche ('' P0'', '' P1'' ou les deux '' P2'').", + "input.onPinPressed|block":"sur pin|%NAME|pressed", + "input.onPinPressed|param|body":"TODO", + "input.onPinPressed|param|name":"TODO", "input.onScreenDown":"Attache le code à exécuter lorsque l'écran vers le bas.", + "input.onScreenDown|param|body":"TODO", "input.onScreenUp":"Attache le code à exécuter lorsque l'écran vers le haut.", + "input.onScreenUp|param|body":"TODO", "input.onShake":"Attache le code à exécuter lorsque l'appareil est secoué.", + "input.onShake|param|body":"TODO", "input.pinIsPressed":"Obtenir l'état de la broche (pressé ou non). Nécessite de tenir au sol pour fermer le circuit.", + "input.pinIsPressed|block":"pin|%NAME|is pressée", + "input.pinIsPressed|param|name":"broche utilisée pour détecter le toucher", "input.rotation":"La hauteur de l'appareil, rotation sur axe le '' x '', en degrés.", + "input.rotation|block":"rotation (°) |%NAME", + "input.rotation|param|kind":"TODO", "input.runningTime":"Obtient le nombre de millisecondes écoulées depuis le pouvoir sur.", + "input.runningTime|block":"temps d’exécution (ms)", "input.setAccelerometerRange":"Définit la plage d'échantillon accéléromètre de gravités.", + "input.setAccelerometerRange|block":"Définissez accelerometer|range % plage", + "input.setAccelerometerRange|param|range":"une valeur décrivent l’assurer une rigidité maximale d’accélération mesurée", "input.temperature":"Obtient la température en Celsius degrés (° C).", + "input.temperature|block":"température (° C)", + "input|block":"entrée", "led":"Contrôle de l'écran LED.", "led.brightness":"Descendre la luminosité de l'écran de 0 () à 255 (pleine intensité).", + "led.brightness|block":"luminosité", "led.fadeIn":"Fondu dans l'affichage à l'écran.", + "led.fadeIn|param|ms":"TODO", "led.fadeOut":"S'évanouit la luminosité de l'écran.", + "led.fadeOut|param|ms":"TODO", "led.plot":"Allumer la LED spécifiée par x, y coordonnées (x est horizontal, y est verticale). (0,0) est en haut à gauche.", "led.plotAll":"Tous les voyants s'allume", "led.plotBarGraph":"Affiche un graphique à barres vertical basé sur la « valeur » et la valeur « élevée ».\nSi « élevé » est 0, le tableau s'ajuste automatiquement.", + "led.plotBarGraph|block":"tracer le graphe de % valeur |à %high", + "led.plotBarGraph|param|high":"valeur maximale. Si 0, la valeur maximale ramenée automatiquement, par exemple: 0", + "led.plotBarGraph|param|value":"valeur actuelle pour tracer", + "led.plot|block":"allumer|x %x|y %y", + "led.plot|param|x":"TODO", + "led.plot|param|y":"TODO", "led.point":"Obtenir l'État marche\/arrêt de la LED spécifiée par x, y coordonnées. (0,0) est en haut à gauche.", + "led.point|block":"point|x %x|y %y", + "led.point|param|x":"TODO", + "led.point|param|y":"TODO", "led.screenshot":"Prend une capture d'écran de l'écran LED et renvoie une image.", "led.setBrightness":"Régler la luminosité de l'écran de 0 (off) à 255 (pleine intensité).", + "led.setBrightness|block":"spécifier la luminosité %value", + "led.setBrightness|param|value":"valeur de la luminosité, par exemple: 255, 127, 0", "led.setDisplayMode":"Définit le mode d'affichage entre noir et blanc et gris pour le rendu des LEDs.", + "led.setDisplayMode|param|mode":"TODO", "led.stopAnimation":"Annule l'animation actuelle et efface les autres en attente d'animations.", + "led.stopAnimation|block":"arrêter l’animation", "led.toggle":"Active\/désactive un pixel particulier", "led.toggleAll":"Inverse l'affichage actuel", + "led.toggle|param|x":"TODO", + "led.toggle|param|y":"TODO", "led.unplot":"Éteindre la LED spécifiée par x, y coordonnées (x est horizontal, y est verticale). (0,0) est en haut à gauche.", + "led.unplot|block":"éteindre|x %x|y %y", + "led.unplot|param|x":"TODO", + "led.unplot|param|y":"TODO", + "led|block":"écran", "music":"Génération de sonneries musicales via broche '' P0''.", "music.beat":"Retourne la durée d'un battement en milli-secondes", + "music.beat|block":"%fraction|beat", "music.changeTempoBy":"Changer le tempo de la quantité spécifiée", + "music.changeTempoBy|block":"changer le tempo par (bpm) | % valeur", + "music.changeTempoBy|param|bpm":"Le changement en battements par minute au tempo, par exemple: 20", "music.noteFrequency":"Obtient la fréquence d'une note.", + "music.noteFrequency|block":"%note", + "music.noteFrequency|param|name":"le nom de la note", "music.playTone":"Joue une tonalité via broche '' P0'' pour la durée donnée.", + "music.playTone|block":"jouer|ton %note=device_note|pendant %duration=device_beat", + "music.playTone|param|frequency":"hauteur de la tonalité pour jouer en Hertz (Hz)", + "music.playTone|param|ms":"durée de la tonalité en millisecondes (ms)", "music.rest":"Repose (joue rien) pendant une durée spécifiée via broche '' P0''.", + "music.rest|block":"repos (ms) |%duration = device_beat", + "music.rest|param|ms":"reposer la durée en millisecondes (ms)", "music.ringTone":"Joue une tonalité via broche '' P0''.", + "music.ringTone|block":"buzz (Hz)|%note=device_note", + "music.ringTone|param|frequency":"hauteur de la tonalité pour jouer en Hertz (Hz)", "music.setTempo":"Définit le tempo à la quantité spécifiée", + "music.setTempo|block":"réglage de tempo pour (bpm) | % valeur", + "music.setTempo|param|bpm":"Le nouveau tempo en battements par minute, par exemple: 120", "music.tempo":"Retourne le tempo en battements par minute. Tempo est la vitesse (bpm = battements par minute) à qui jouent des notes. Plus la valeur du tempo, plus vite les notes jouera.", + "music.tempo|block":"tempo (bpm)", + "music|block":"musique", "pins":"Contrôle des courants à Pins pour signaux analogiques\/numériques, servos, i2c...", "pins.analogPitch":"Émet un signal de modulation (PWM) de largeur d'impulsion à l'axe de tangage actuelle. Utilisez « analog set axe de tangage » pour définir l'axe de tangage.", + "pins.analogPitch|param|frequency":"TODO", + "pins.analogPitch|param|ms":"TODO", "pins.analogReadPin":"Lire la valeur de connecteur analogique, c'est-à-dire comme une valeur comprise entre 0 et 1023.", + "pins.analogReadPin|block":"read|pin analogique %name", + "pins.analogReadPin|param|name":"broche d’écrire à", "pins.analogSetPeriod":"Configure la modulation de largeur d'impulsion (PWM) de la sortie à la valeur donnée en analogique ** microsecondes ** ou « 1\/1000' millisecondes.\nSi cette broche n'est pas configurée comme un analogue de sortie (en utilisant « écriture analogique pin »), l'opération n'a aucun effet.", + "pins.analogSetPeriod|block":"Analog set period|pin %pin|to micros % (µs)", + "pins.analogSetPeriod|param|micros":"période en micro secondes. par exemple: 20000", + "pins.analogSetPeriod|param|name":"broche analogique pour définir le délai", "pins.analogSetPitchPin":"Définit l'axe utilisé lors de l'utilisation de \"pins-> pitch analogique\".", + "pins.analogSetPitchPin|param|name":"TODO", "pins.analogWritePin":"Définissez la valeur de connecteur analogique. Valeur doit être comprise entre 0 et 1023.", + "pins.analogWritePin|block":"write|pin analogique %name|to % valeur", + "pins.analogWritePin|param|name":"nom de la broche d’écrire à", + "pins.analogWritePin|param|value":"valeur à écrire sur la broche entre '' 0'' et '' 1023''. par exemple: 1023, 0", "pins.digitalReadPin":"Lire la broche spécifié ou le connecteur comme 0 ou 1", + "pins.digitalReadPin|block":"read|pin numérique %name", + "pins.digitalReadPin|param|name":"broche pour lire à partir", "pins.digitalWritePin":"Définir une valeur de code pin ou le connecteur à 0 ou 1.", + "pins.digitalWritePin|block":"write|pin numérique %name|to % valeur", + "pins.digitalWritePin|param|name":"broche d’écrire à", + "pins.digitalWritePin|param|value":"valeur à définir sur la broche, 1 par exemple, 0", "pins.i2cReadNumber":"Lire un numéro de 7-bit I2C adresse.", + "pins.i2cReadNumber|block":"I2C lire number|at adresse %address|of format %format = i2c_sizeof", "pins.i2cWriteNumber":"Écrire un nombre à une adresse I2C de 7 bits.", + "pins.i2cWriteNumber|block":"I2C écrire number|at adresse %address|with valeur % value|of format %format = i2c_sizeof", "pins.map":"Remappe un nombre d'une plage à l'autre. Autrement dit, une valeur '' de faible '' serait sont mappée aux '' à faible '', une valeur de '' de haut '' à '' à haute '', valeurs intermédiaires à etc in-between, de valeurs.", + "pins.map|block":"carte % value|from %fromLow|from basse %fromHigh|to haute basse %toLow|to haute %toHigh", + "pins.map|param|fromHigh":"limite la supérieure de la gamme actuelle de la valeur, par exemple: 1023", + "pins.map|param|fromLow":"la limite inférieure de la gamme actuelle de la valeur", + "pins.map|param|toHigh":"la limite supérieure de la cible de la valeur du rang, par exemple: 4", + "pins.map|param|toLow":"la limite inférieure de la fourchette cible de la valeur", + "pins.map|param|value":"valeur à la carte dans les rangs", "pins.onPulsed":"Configure cette broche pour une entrée numérique et génère des événements où l’horodatage est la durée pendant laquelle cette broche a été '' élevé '' ou '' faible ''.", + "pins.onPulsed|block":"on|pin %pin|pulsed %pulse", "pins.pulseDuration":"Obtient la durée de la dernière impulsion en microsecondes. Cette fonction doit être appelée à partir d’un gestionnaire de '' onPulsed''.", + "pins.pulseDuration|block":"durée de l’impulsion (µs)", "pins.servoSetPulse":"Configure cette broche e\/s comme une sortie analogique\/pwm, configure le laps de temps pour être 20 ms et définit la largeur d'impulsion, basée sur la valeur, il est donné ** microsecondes ** ou « 1\/1000' millisecondes.", + "pins.servoSetPulse|block":"servo set pulse|pin % value|to (µs) % micros", + "pins.servoSetPulse|param|micros":"durée de l’impulsion en micro secondes, par exemple: 1500", + "pins.servoSetPulse|param|name":"nom de code PIN", "pins.servoWritePin":"Écrit une valeur à l'asservissement, contrôle de l'arbre en conséquence. Sur un servo standard, cette fonction définira l'angle de l'arbre (en degrés), déplacer l'arbre à cette orientation. Sur un servo de rotation continue, cette fonction définira la vitesse du servo (avec '' 0'' en pleine vitesse dans une seule direction, '' 180 cm en pleine vitesse dans l'autre et une valeur de près de 90 '''' aucun mouvement).", + "pins.servoWritePin|block":"servo write|pin %name|to % de la valeur", + "pins.servoWritePin|param|name":"broche d’écrire à", + "pins.servoWritePin|param|value":"angle ou rotation à vitesse, par exemple: 0, 90 et 180", "pins.setPull":"Configure l’attraction de cette broche.", + "pins.setPull|block":"Set pull|pin %pin|to %pull", + "pins.setPull|param|name":"broche pour définir le mode de traction sur", + "pins.setPull|param|pull":"une des configurations mbed pull : PullUp, menu déroulant, PullNone ", + "pins|block":"broches", "serial":"Lire et écrire des données sur une connexion série.", "serial.readLine":"Lit une ligne de texte à partir du port série.", + "serial.readLine|block":"série lire ligne", "serial.redirect":"Configuration dynamique de l’instance de série pour utiliser des épingles autres que USBTX et USBRX.", + "serial.redirect|block":"redirection série to| TX %tx| Taux % du taux de baud rx|at RX %", + "serial.redirect|param|rx":"le nouveau NIP de réception", + "serial.redirect|param|tx":"les nouvelles goupilles de transmission", "serial.writeLine":"Imprime une ligne de texte pour le numéro de série", + "serial.writeLine|block":"Serial|Write ligne %text", "serial.writeNumber":"Imprime une valeur numérique de la série", + "serial.writeNumber|block":"% valeur Serial|Write", "serial.writeString":"Envoie un morceau de texte via la connexion série.", - "serial.writeValue":"Écrit un « nom : valeur '' paire de ligne de la série." + "serial.writeString|block":"%text chaîne série écriture", + "serial.writeValue":"Écrit un « nom : valeur '' paire de ligne de la série.", + "serial.writeValue|block":"serial|écrire valeur %name|= %valeur", + "serial.writeValue|param|name":"nom de la valeur stream, par exemple: x", + "serial.writeValue|param|value":"Écrire", + "serial|block":"Serial" } \ No newline at end of file diff --git a/libs/microbit/_locales/microbit-strings.json b/libs/microbit/_locales/microbit-strings.json index 90514785..73404cb4 100644 --- a/libs/microbit/_locales/microbit-strings.json +++ b/libs/microbit/_locales/microbit-strings.json @@ -1,92 +1,240 @@ { "Math.randomBoolean": "Generates a `true` or `false` value randomly, just like flipping a coin.", + "Math.randomBoolean|block": "pick random true or false", + "Math|block": "Math", "String.fromCharCode": "Make a string from the given ASCII character code.", + "String.fromCharCode|block": "text from char code %code", + "String|block": "String", "basic": "Provides access to basic micro:bit functionality.", "basic.clearScreen": "Turn off all LEDs", + "basic.clearScreen|block": "clear screen", "basic.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.", + "basic.forever|block": "forever", "basic.pause": "Pause for the specified time in milliseconds", + "basic.pause|block": "pause (ms) %pause", + "basic.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000", "basic.plotLeds": "Draws an image on the LED screen.", + "basic.plotLeds|param|leds": "pattern of LEDs to turn on/off", "basic.showAnimation": "Shows a sequence of LED screens as an animation.", + "basic.showAnimation|param|interval": "time in milliseconds between each redraw", + "basic.showAnimation|param|leds": "pattern of LEDs to turn on/off", "basic.showLeds": "Draws an image on the LED screen.", + "basic.showLeds|block": "show leds", + "basic.showLeds|param|interval": "time in milliseconds to pause after drawing", + "basic.showLeds|param|leds": "the pattern of LED to turn on/off", "basic.showNumber": "Scroll a number on the screen. If the number fits on the screen (i.e. is a single digit), do not scroll.", + "basic.showNumber|block": "show|number %number", + "basic.showNumber|param|interval": "speed of scroll; eg: 150, 100, 200, -100", "basic.showString": "Display text on the display, one character at a time. If the string fits on the screen (i.e. is one letter), does not scroll.", + "basic.showString|block": "show|string %text", + "basic.showString|param|interval": "how fast to shift characters; eg: 150, 100, 200, -100", + "basic.showString|param|text": "the text to scroll on the screen, eg: \"Hello!\"", + "basic|block": "basic", "control": "Runtime and event utilities.", "control.inBackground": "Schedules code that run in the background.", + "control.inBackground|block": "run in background", "control.reset": "Resets the BBC micro:bit.", + "control.reset|block": "reset", + "control|block": "control", "game": "A single-LED sprite game engine", "game.addScore": "Adds points to the current score", + "game.addScore|block": "change score by|%points", + "game.addScore|param|points": "amount of points to change, eg: 1", "game.gameOver": "Displays a game over animation.", + "game.gameOver|block": "game over", "game.score": "Gets the current score", + "game.score|block": "score", "game.setScore": "Sets the current score value", + "game.setScore|param|value": "TODO", "game.startCountdown": "Starts a game countdown timer", + "game.startCountdown|block": "start countdown|(ms) %duration", + "game.startCountdown|param|ms": "countdown duration in milliseconds, eg: 10000", + "game|block": "game", "images": "Creation, manipulation and display of LED images.", "images.createBigImage": "Creates an image with 2 frames.", + "images.createBigImage|block": "create big image", "images.createImage": "Creates an image that fits on the LED screen.", + "images.createImage|block": "create image", + "images|block": "images", "input": "Events and data from sensors", "input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)", + "input.acceleration|block": "acceleration (mg)|%NAME", + "input.acceleration|param|dimension": "TODO", "input.buttonIsPressed": "Get the button state (pressed or not) for ``A`` and ``B``.", + "input.buttonIsPressed|block": "button|%NAME|is pressed", "input.calibrate": "Obsolete, compass calibration is automatic.", "input.compassHeading": "Get the current compass compass heading in degrees.", + "input.compassHeading|block": "compass heading (°)", "input.lightLevel": "Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.", + "input.lightLevel|block": "light level", "input.magneticForce": "Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.", + "input.magneticForce|block": "magnetic force (µT)|%NAME", + "input.magneticForce|param|dimension": "TODO", "input.onButtonPressed": "Do something when a button (``A``, ``B`` or both ``A+B``) is pressed", + "input.onButtonPressed|block": "on button|%NAME|pressed", + "input.onButtonPressed|param|body": "TODO", + "input.onButtonPressed|param|button": "TODO", "input.onGesture": "Attaches code to run when the screen is facing up.", + "input.onGesture|block": "on |%NAME", + "input.onGesture|param|body": "TODO", "input.onLogoDown": "Attaches code to run when the logo is oriented downwards and the board is vertical.", + "input.onLogoDown|param|body": "TODO", "input.onLogoUp": "Attaches code to run when the logo is oriented upwards and the board is vertical.", + "input.onLogoUp|param|body": "TODO", "input.onPinPressed": "Do something when a pin(``P0``, ``P1`` or both ``P2``) is pressed.", + "input.onPinPressed|block": "on pin|%NAME|pressed", + "input.onPinPressed|param|body": "TODO", + "input.onPinPressed|param|name": "TODO", "input.onScreenDown": "Attaches code to run when the screen is facing down.", + "input.onScreenDown|param|body": "TODO", "input.onScreenUp": "Attaches code to run when the screen is facing up.", + "input.onScreenUp|param|body": "TODO", "input.onShake": "Attaches code to run when the device is shaken.", + "input.onShake|param|body": "TODO", "input.pinIsPressed": "Get the pin state (pressed or not). Requires to hold the ground to close the circuit.", + "input.pinIsPressed|block": "pin|%NAME|is pressed", + "input.pinIsPressed|param|name": "pin used to detect the touch", "input.rotation": "The pitch of the device, rotation along the ``x-axis``, in degrees.", + "input.rotation|block": "rotation (°)|%NAME", + "input.rotation|param|kind": "TODO", "input.runningTime": "Gets the number of milliseconds elapsed since power on.", + "input.runningTime|block": "running time (ms)", "input.setAccelerometerRange": "Sets the accelerometer sample range in gravities.", + "input.setAccelerometerRange|block": "set accelerometer|range %range", + "input.setAccelerometerRange|param|range": "a value describe the maximum strengh of acceleration measured", "input.temperature": "Gets the temperature in Celsius degrees (°C).", + "input.temperature|block": "temperature (°C)", + "input|block": "input", "led": "Control of the LED screen.", "led.brightness": "Get the screen brightness from 0 (off) to 255 (full bright).", + "led.brightness|block": "brightness", "led.fadeIn": "Fades in the screen display.", + "led.fadeIn|param|ms": "TODO", "led.fadeOut": "Fades out the screen brightness.", + "led.fadeOut|param|ms": "TODO", "led.plot": "Turn on the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.", "led.plotAll": "Turns all LEDS on", "led.plotBarGraph": "Displays a vertical bar graph based on the `value` and `high` value.\nIf `high` is 0, the chart gets adjusted automatically.", + "led.plotBarGraph|block": "plot bar graph of %value |up to %high", + "led.plotBarGraph|param|high": "maximum value. If 0, maximum value adjusted automatically, eg: 0", + "led.plotBarGraph|param|value": "current value to plot", + "led.plot|block": "plot|x %x|y %y", + "led.plot|param|x": "TODO", + "led.plot|param|y": "TODO", "led.point": "Get the on/off state of the specified LED using x, y coordinates. (0,0) is upper left.", + "led.point|block": "point|x %x|y %y", + "led.point|param|x": "TODO", + "led.point|param|y": "TODO", "led.screenshot": "Takes a screenshot of the LED screen and returns an image.", "led.setBrightness": "Set the screen brightness from 0 (off) to 255 (full bright).", + "led.setBrightness|block": "set brightness %value", + "led.setBrightness|param|value": "the brightness value, eg:255, 127, 0", "led.setDisplayMode": "Sets the display mode between black and white and greyscale for rendering LEDs.", + "led.setDisplayMode|param|mode": "TODO", "led.stopAnimation": "Cancels the current animation and clears other pending animations.", + "led.stopAnimation|block": "stop animation", "led.toggle": "Toggles a particular pixel", "led.toggleAll": "Inverts the current LED display", + "led.toggle|param|x": "TODO", + "led.toggle|param|y": "TODO", "led.unplot": "Turn off the specified LED using x, y coordinates (x is horizontal, y is vertical). (0,0) is upper left.", + "led.unplot|block": "unplot|x %x|y %y", + "led.unplot|param|x": "TODO", + "led.unplot|param|y": "TODO", + "led|block": "led", "music": "Generation of music tones through pin ``P0``.", "music.beat": "Returns the duration of a beat in milli-seconds", + "music.beat|block": "%fraction|beat", "music.changeTempoBy": "Change the tempo by the specified amount", + "music.changeTempoBy|block": "change tempo by (bpm)|%value", + "music.changeTempoBy|param|bpm": "The change in beats per minute to the tempo, eg: 20", "music.noteFrequency": "Gets the frequency of a note.", + "music.noteFrequency|block": "%note", + "music.noteFrequency|param|name": "the note name", "music.playTone": "Plays a tone through pin ``P0`` for the given duration.", + "music.playTone|block": "play|tone %note=device_note|for %duration=device_beat", + "music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)", + "music.playTone|param|ms": "tone duration in milliseconds (ms)", "music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.", + "music.rest|block": "rest(ms)|%duration=device_beat", + "music.rest|param|ms": "rest duration in milliseconds (ms)", "music.ringTone": "Plays a tone through pin ``P0``.", + "music.ringTone|block": "ring tone (Hz)|%note=device_note", + "music.ringTone|param|frequency": "pitch of the tone to play in Hertz (Hz)", "music.setTempo": "Sets the tempo to the specified amount", + "music.setTempo|block": "set tempo to (bpm)|%value", + "music.setTempo|param|bpm": "The new tempo in beats per minute, eg: 120", "music.tempo": "Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.", + "music.tempo|block": "tempo (bpm)", + "music|block": "music", "pins": "Control currents in Pins for analog/digital signals, servos, i2c, ...", "pins.analogPitch": "Emits a Pulse-width modulation (PWM) signal to the current pitch pin. Use `analog set pitch pin` to define the pitch pin.", + "pins.analogPitch|param|frequency": "TODO", + "pins.analogPitch|param|ms": "TODO", "pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.", + "pins.analogReadPin|block": "analog read|pin %name", + "pins.analogReadPin|param|name": "pin to write to", "pins.analogSetPeriod": "Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.", + "pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros", + "pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000", + "pins.analogSetPeriod|param|name": "analog pin to set period to", "pins.analogSetPitchPin": "Sets the pin used when using `pins->analog pitch`.", + "pins.analogSetPitchPin|param|name": "TODO", "pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.", + "pins.analogWritePin|block": "analog write|pin %name|to %value", + "pins.analogWritePin|param|name": "pin name to write to", + "pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0", "pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1", + "pins.digitalReadPin|block": "digital read|pin %name", + "pins.digitalReadPin|param|name": "pin to read from", "pins.digitalWritePin": "Set a pin or connector value to either 0 or 1.", + "pins.digitalWritePin|block": "digital write|pin %name|to %value", + "pins.digitalWritePin|param|name": "pin to write to", + "pins.digitalWritePin|param|value": "value to set on the pin, 1 eg,0", "pins.i2cReadNumber": "Read one number from 7-bit I2C address.", + "pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof", "pins.i2cWriteNumber": "Write one number to a 7-bit I2C address.", + "pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof", "pins.map": "Re-maps a number from one range to another. That is, a value of ``from low`` would get mapped to ``to low``, a value of ``from high`` to ``to high``, values in-between to values in-between, etc.", + "pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh", + "pins.map|param|fromHigh": "the upper bound of the value's current range, eg: 1023", + "pins.map|param|fromLow": "the lower bound of the value's current range", + "pins.map|param|toHigh": "the upper bound of the value's target range, eg: 4", + "pins.map|param|toLow": "the lower bound of the value's target range", + "pins.map|param|value": "value to map in ranges", "pins.onPulsed": "Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.", + "pins.onPulsed|block": "on|pin %pin|pulsed %pulse", "pins.pulseDuration": "Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.", + "pins.pulseDuration|block": "pulse duration (µs)", "pins.servoSetPulse": "Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds.", + "pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros", + "pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500", + "pins.servoSetPulse|param|name": "pin name", "pins.servoWritePin": "Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).", + "pins.servoWritePin|block": "servo write|pin %name|to %value", + "pins.servoWritePin|param|name": "pin to write to", + "pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0", "pins.setPull": "Configures the pull of this pin.", + "pins.setPull|block": "set pull|pin %pin|to %pull", + "pins.setPull|param|name": "pin to set the pull mode on", + "pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ", + "pins|block": "pins", "serial": "Reading and writing data over a serial connection.", "serial.readLine": "Reads a line of text from the serial port.", + "serial.readLine|block": "serial read line", "serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.", + "serial.redirect|block": "serial redirect to|TX %tx|RX %rx|at baud rate %rate", + "serial.redirect|param|rx": "the new reception pin", + "serial.redirect|param|tx": "the new transmission pins", "serial.writeLine": "Prints a line of text to the serial", + "serial.writeLine|block": "serial|write line %text", "serial.writeNumber": "Prints a numeric value to the serial", + "serial.writeNumber|block": "serial|write number %value", "serial.writeString": "Sends a piece of text through Serial connection.", - "serial.writeValue": "Writes a ``name: value`` pair line to the serial." + "serial.writeString|block": "serial write string %text", + "serial.writeValue": "Writes a ``name: value`` pair line to the serial.", + "serial.writeValue|block": "serial|write value %name|= %value", + "serial.writeValue|param|name": "name of the value stream, eg: x", + "serial.writeValue|param|value": "to write", + "serial|block": "serial" } \ No newline at end of file diff --git a/package.json b/package.json index b0783fb8..55dd0966 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pxt-microbit", - "version": "0.2.166", + "version": "0.2.173", "description": "BBC micro:bit target for PXT", "keywords": [ "JavaScript", @@ -29,6 +29,6 @@ "typescript": "^1.8.7" }, "dependencies": { - "pxt-core": "0.2.179" + "pxt-core": "0.2.184" } } diff --git a/pxtarget.json b/pxtarget.json index bfe28e6c..1cd50988 100644 --- a/pxtarget.json +++ b/pxtarget.json @@ -110,8 +110,8 @@ "path": "/blocks" }, { - "name": "TypeScript", - "path": "/typescript" + "name": "JavaScript", + "path": "/javascript" } ], "sideDoc": "getting-started"