微軟 micro:bit 創意課程系列--The amazing coin flipper

2017-08-15 10:05

微軟 micro:bit 創意課程系列--

The amazing coin flipper

 

你是否試圖選擇是否踢足球還是去看電影,還是選擇哪一個比薩餅? 建立一個硬幣翻轉機與the micro:bit選擇為你!

 

這是製作你的錢幣的塊。 當您按下按鈕B時,硬幣擋板將在LED屏幕上顯示H的頭或T表示尾部

 

 

 

The Math.randomBoolean() block randomly tells the if block true or false. If value picked is true, the if block shows the letter H. Otherwise, it shows the letter T.

That’s it!

Math.randomBoolean()塊隨機地告訴if塊是真還是假。 如果選擇的值為真,則if塊顯示字母H.否則,它顯示字母T.

而已!

Keeping score

為了跟踪您贏得了多少猜測,請將這些塊添加到您的硬幣蓋板中:

這些塊意味著如果按下按鈕A,您將添加1到您的分數,如果您一起按A和B,the micro:bit 將顯示您的分數。

完成後,您的硬幣翻轉程序應如下所示:

翻轉直到你的拇指累了!

 

Microbit 台灣 商店

Microbit 中文 課程 : Python , Javascript, 物聯網

              中國

Edit this page on GitHub

—————

返回