Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Martin Woolley 2016-06-21 08:08:12 +01:00
commit 08cd04b2c8
103 changed files with 2418 additions and 489 deletions

8
.gitignore vendored
View File

@ -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?

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -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

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7DC6CA45-FD75-44BC-805E-708C812CD4BF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.MicroBit</RootNamespace>
<AssemblyName>Microbit.Uploader</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<DelaySign>false</DelaySign>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Settings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Settings.Designer.cs">
<DependentUpon>Settings.cs</DependentUpon>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="KnownFolders.cs" />
<Compile Include="LicenseDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LicenseDialog.Designer.cs">
<DependentUpon>LicenseDialog.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SingleInstanceAppHelper.cs" />
<Compile Include="SingleInstanceAppStarter.cs" />
<EmbeddedResource Include="LicenseDialog.resx">
<DependentUpon>LicenseDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Settings.resx">
<DependentUpon>Settings.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MSFT_logo_png.png" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Resources\MSR-LA - 2576.rtf" />
</ItemGroup>
<ItemGroup>
<Content Include="favicon.ico" />
<EmbeddedResource Include="microbit.red.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,33 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Management;
using System.Runtime.InteropServices;
using System.Security;
namespace Microsoft.MicroBit
{
/// <summary>
/// Class containing methods to retrieve specific file system paths.
/// </summary>
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);
}
}

View File

@ -0,0 +1,93 @@
namespace Microsoft.MicroBit
{
partial class LicenseDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

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

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,172 @@
namespace Microsoft.MicroBit
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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<String> drives = new List<String>();
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<string> drives)
{
var waitHandles = new List<WaitHandle>();
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<DriveInfo>();
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();
}
}
}

View File

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="trayIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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==
</value>
</data>
</root>

View File

@ -0,0 +1,30 @@
using Microsoft.VisualBasic.ApplicationServices;
using System;
using System.Windows.Forms;
namespace Microsoft.MicroBit
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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;
}
}
}

View File

@ -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")]

View File

@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.MicroBit.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap microbit_red {
get {
object obj = ResourceManager.GetObject("microbit_red", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap MSFT_logo_png {
get {
object obj = ResourceManager.GetObject("MSFT_logo_png", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 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]&quot;;.
/// </summary>
internal static string MSR_LA___2576 {
get {
return ResourceManager.GetString("MSR_LA___2576", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="MSR_LA___2576" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MSR-LA - 2576.rtf;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="MSFT_logo_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\MSFT_logo_png.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="microbit_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\microbit.red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1 @@
TBD

View File

@ -0,0 +1,76 @@
namespace Microsoft.MicroBit
{
partial class Settings
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

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

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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) {

View File

@ -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!

View File

@ -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.

View File

@ -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`.

View File

@ -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' ?
<br/>
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").
<br/>
```
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?
<br/>
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.
<br/>
```
input.onButtonPressed(Button.A, () => {
offset = offset + 1
})
```

View File

@ -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' ?
<br/>
## 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".
<br/>
<br/>
## 3. Write the one line of code to show this image
![](/static/mb/lessons/offset-image-0.png)
<br/>
<br/>
## 4. Write the two lines of code that trigger the variable offset to increase by one.
![](/static/mb/lessons/offset-image-1.png)
<br/>

View File

@ -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.

View File

@ -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"
}]
```

View File

@ -1,4 +1,4 @@
# Micro:bit APIs
# Reference
```namespaces
basic.showNumber(0);

View File

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

View File

@ -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
```

View File

@ -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
```

View File

@ -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
```

View File

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

View File

@ -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
```

View File

@ -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
```

View File

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

View File

@ -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
```

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

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

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -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

View File

@ -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

View File

@ -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":"مصدر الاتصال"
}

View File

@ -1,92 +1,240 @@
{
"Math.randomBoolean":"Génère une valeur « true » ou « false » au hasard, tout comme le retournement dune 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 dintensité 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 dexé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 lassurer une rigidité maximale daccé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 lanimation",
"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ù lhorodatage 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 dun gestionnaire de '' onPulsed''.",
"pins.pulseDuration|block":"durée de limpulsion (µ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 limpulsion 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 lattraction 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 linstance 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"
}

Some files were not shown because too many files have changed in this diff Show More