makecode_一键部署MakeCode和出色的AdaFruit Circuit Playground Express

makecode

makecode

Circuit Playground Express and Crickit

There's a ton of great open source hardware solutions out there. Often they're used to teach kids how to code, but their also fun for adults to learn about hardware!

有很多很棒的开源硬件解决方案。 通常,他们习惯于教孩子们如何编码,但是对于成年人来说,学习硬件也很有趣!

Ultimately that "LED Moment" can be the start of a love affair with open source hardware and software! Arduino is great, as is Arduino talking to the Cloud! If that's too much or too many moving parts, you always start small with other little robot kits for kids.

最终,“ LED Moment ”可以成为与开源硬件和软件恋爱的开始! Arduino很棒, Arduino与云对话也很棒! 如果活动部件过多或过多,那么您总是从其他用于儿童的小型机器人套件开始。

Recently my 10 year old and I have been playing with the Circuit Playground Express from Adafruit. We like it because it supports not just block-based programming and JavaScript via MakeCode (more on that in a moment) but you can also graduate to Circuit Python. Want to be even more advanced/ You can also use the Arduino IDE to talk to Circuit Playground Express. It's quickly becoming our favorite board. Be sure to get the board, some batteries and a holder, as well as a few alligator clips.

最近,我和我10岁,一直在玩Adafruit的Circuit Playground Express 。 我们之所以喜欢它,是因为它不仅支持通过MakeCode进行基于块的编程和JavaScript(稍后对此进行更多介绍),而且您还可以升级到Circuit Python。 想要更高级/您还可以使用Arduino IDE与Circuit Playground Express对话。 它正Swift成为我们最喜​​欢的董事会。 确保拿到板子,一些电池和一个支架以及一些鳄鱼夹。

The Circuit Playground Express board is round and has alligator-clip pads around it so you don't have to solder to get started. It has as bunch of sensors for light, temperature, motion, sound, as well as an IR receiver and transmitter and LEDs for visual output. There's a million things you can do with it. This summer Microsoft Research is doing a project a week you can do with the kids in your life with Make Code!

Circuit Playground Express电路板是圆形的,周围有鳄鱼夹,因此您无需焊接即可上手。 它具有用于光线,温度,运动,声音的传感器,以及用于视觉输出的IR接收器和发射器以及LED。 您可以用它做一百万件事。 今年夏天, Microsoft Research每周都会开展一个项目,您可以使用Make Code与孩子们一起生活!

I think the Circuit Playground Express is excellent by itself, but I like that I can stack it on top of the AdaFruit Crickit to make a VERY capable robotics platform. It's an ingenious design where three screws and metal standoffs connect the Crickit to the Circuit Playground and provide a bus for power and communication. The 10 year old wants to make a BattleBot now.

我认为Circuit Playground Express本身就非常出色,但是我喜欢将其堆叠在AdaFruit Crickit之上,以构建功能非常强大的机器人平台。 这是一个巧妙的设计,其中三个螺丝和金属支架将Crickit连接到Circuit Playground,并提供用于供电和通讯的总线。 这个10岁的孩子想立即制作一个BattleBot。

Sitting architecturally on top of all this great hardware is the open source Microsoft Make Code development environment. It's amazing and more people should be talking about it. MakeCode works with LEGO Mindstorms EV3, micro:bit, Circuit Playground Express, Minecraft, Cue robots, Chibichips, and more. The pair of devices is truly awesome.

开源的Microsoft Make Code开发环境在结构上位于所有这些强大的硬件之上。 太神奇了,更多的人应该谈论它。 MakeCode可与LEGO Mindstorms EV3,micro:bit,Circuit Playground Express,Minecraft,Cue机器人,Chibichips等配合使用。 这对设备确实很棒。

Frankly I'm blown away at how easy it is and how easily my kids were productive. The hardest part of the whole thing was the last step where they need to copy the compiled code to the Circuit Playground Express. The editor is all online at GitHub https://github.com/Microsoft/pxt and you can run it locally if you like but there's no reason to unless you're developing new packages.

坦白说,我对它的容易程度和我的孩子们的生产率容易程度感到震惊。 整个过程中最困难的部分是最后一步,他们需要将编译后的代码复制到Circuit Playground Express。 该编辑器在GitHub https://github.com/Microsoft/pxt上都是在线的,您可以根据需要在本地运行它,但是除非开发新的软件包,否则没有理由。

We went to https://makecode.adafruit.com/ for the Circuit Playground Express. We made a new project (and optionally added the Crickit board blocks as an extension) and then got to work. The 10 year old followed a tutorial and made a moisture sensor that uses an alligator clip and a nail to check if our plants need to be watered! (If they do, it beeps and turns red!)

我们访问了https://makecode.adafruit.com/的Circuit Playground Express。 我们创建了一个新项目(并可选地添加了Crickit板块作为扩展),然后开始工作。 这位10岁的孩子按照教程进行操作,制作了一个湿度传感器,该湿度传感器使用鳄鱼夹和指甲检查我们的植物是否需要浇水! (如果这样做,它会发出哔哔声并变成红色!)

You can see the code here as blocks...

您可以在此处将代码视为块...

The MakeCode IDE

or see the same code as JavaScript!

或查看与JavaScript相同的代码!

let Soil_reading = 0
let dry_value = 0
dry_value = 1500
light.setBrightness(45)
light.setAll(0x00ff00)
forever(function () {Soil_reading = input.pinA1.value()console.logValue("Soil reading", Soil_reading)if (Soil_reading < dry_value) {light.setAll(0xff0000)music.playTone(262, music.beat(BeatFraction.Half))} else {light.clear()}pause(__internal.__timePicker(2000))
})

When you've written your code, you just click DOWNLOAD and you'll get a "uf2" file.

编写代码后,只需单击“下载”,您将获得一个“ uf2”文件。

Downloading compiled MakeCode UF2 files

Then the hardest part, you plug in the Circuit Playground Express via USB, it shows up as a Drive called "CPLAYBOOT," and you copy that file over. It's easy for techies, but a speed bump for kids.

然后最困难的部分是,通过USB插入Circuit Playground Express,它显示为名为“ CPLAYBOOT”的驱动器,然后将该文件复制过来。 对于技术人员来说很容易,但是对于孩子来说却是一个减速。

Downloading compiled MakeCode UF2 files

It's really a genius process where they have removed nearly every obstacle in the hardware. After the file gets copied over (literally after the last byte is written) the device resets and starts running it.

这确实是一个天才的过程,他们几乎消除了硬件中的所有障碍。 复制完文件后(字面意思是写入最后一个字节后),设备将复位并开始运行它。

The "Developer's Inner Loop" is as short as possible, so kudos to the team. Code, download, deploy, run/test, repeat.

“开发人员的内在循环”越短越好,因此对团队表示敬意。 编码,下载,部署,运行/测试,重复。

This loop is fast and clever, but I wanted to speed it up a little so I wrote this little utility to automatically copy your MakeCode file to the Circuit Playground Express. Basically the idea is:

这个循环是快速而聪明的,但是我想稍微加快一点,所以我写了这个小工具来自动将您的MakeCode文件复制到Circuit Playground Express 。 基本上,这个想法是:

  • Associate my app with *.uf2 files

    将我的应用与* .uf2文件相关联
  • When launched, look for a local drive labeled CPLAYBOOK and copy the uf2 file over to it.

    启动后,查找标记为CPLAYBOOK的本地驱动器,然后将uf2文件复制到该驱动器。

That's it. It speeds up the experience and saves me a number of clicks. Sure there's batch file/powershell/script ways to do it but this wasn't hard.

而已。 它可以加快体验速度,并为我节省很多点击次数。 当然,有批处理文件/ powershell /脚本的方法可以做到这一点,但这并不难。

static void Main(string[] args)
{var sourceFile = args[0];var drive = (from d in DriveInfo.GetDrives()where d.VolumeLabel == "CPLAYBOOT"select d.RootDirectory).FirstOrDefault();if (drive == null) {Console.WriteLine("Press RESET on your Circuit Playground Express and try again!");Environment.Exit(1);}Console.WriteLine($"Found Circuit Playground Express at {drive.FullName}");File.Copy(sourceFile, Path.Combine(drive.FullName, Path.GetFileName(sourceFile)));
}

Then I double click on the uf2 file and get this dialog and SCROLL DOWN and click "Look for another app on this PC." (They are making this hard because they want you to use a Store App, which I haven't made yet)

然后,我双击uf2文件并获得此对话框,然后向下滚动并单击“在此PC上查找其他应用程序”。 (他们之所以很难,是因为他们希望您使用我尚未制作的Store App)

Selecting a custom app for UF2 files

Now I can just click my uf2 files in Windows Explorer and they'll automatically get deployed to my Circuit Playground Express!

现在,我只需在Windows资源管理器中单击uf2文件,它们就会自动部署到我的Circuit Playground Express中!

Found Circuit Playground Express at D:\

You can find source here https://github.com/shanselman/MakeCodeLaunchAndCopy if you're a developer, just get .NET Core 2.1 and run my .cmd file on Windows to build it yourself. Feel free to make it a Windows Store App if you're an overachiever. Pull Requests appreciated ;)

如果您是开发人员,则可以在这里https://github.com/shanselman/MakeCodeLaunchAndCopy找到源代码,只需获取.NET Core 2.1并在Windows上运行我的.cmd文件即可自行构建。 如果您表现不佳,请随时使其成为Windows Store应用程序。 拉请求赞赏;)

Otherwise, get the a little release here https://github.com/shanselman/MakeCodeLaunchAndCopy/releases and unzip the contents into its own folder on Windows, go double-click a UF2 file and point Windows to the MakeCodeLaunchAndCopy.exe file and you're all set!

否则,请在此处获得一些发行版本https://github.com/shanselman/MakeCodeLaunchAndCopy/releases并将内容解压缩到Windows上自己的文件夹中,双击UF2文件,然后将Windows指向MakeCodeLaunchAndCopy.exe文件,然后都准备好了!

Sponsor: Preview the latest JetBrains Rider with its built-in spell checking, initial Blazor support, partial C# 7.3 support, enhanced debugger, C# Interactive, and a redesigned Solution Explorer.

赞助商:预览最新的JetBrains Rider,包括其内置的拼写检查,Blazor初始支持,部分C#7.3支持,增强的调试器,C#Interactive和重新设计的解决方案资源管理器。

翻译自: https://www.hanselman.com/blog/one-click-deploy-for-makecode-and-the-amazing-adafruit-circuit-playground-express

makecode


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部