2018/12/02

Scratch Programming for Tello

Just bought a Tello Drone from an online shop during Black Friday Sales in Taiwan. I was luck to get the Tello Boost Combo with 3 battery and a 3-in-1 charging hub for USD$110.2
「Tello 3-in-1 charging hub」的圖片搜尋結果
The photo above was from DJI website.

!!! Caution !!!

  • If this is your first try to program Tello with Scratch, please do this in door first!
  • There were few times where I placed wrong blocks and Tello just kept went up and stayed close to celling and I was unable to control it at all. This was caused by wrong command blocks I used. If I was outdoor that time, I didn't know where Tello would fly to.

Download & Install 

  1. Install Scratch 2.0 Offline Editor on your Mac or PC. Download it from here: https://scratch.mit.edu/download This is the Scratch program editor. You will write your code in this editor to control Tello. If you don't know how to use Scratch, here is a good place to learn: https://scratch.mit.edu/projects/editor/?tip_bar=getStarted
  2. Install Node.js from here: https://nodejs.org/en/ This program is simulate the Tello smartphone App that it allows you to communicate your PC/Mac to Tello. You do not need to know how Node.js works. Just run the Tello.js script and Tello will be controlled by Scratch.
    • Remember where Node.js is installed
    • $> Node.js v10.14.0 to /usr/local/bin/node
    • $> npm v6.4.1 to /usr/local/bin/npm
  3. Download Tello.js and Tello.s2e from https://dl-cdn.ryzerobotics.com/downloads/tello/20180910/scratch0907.7z
    • The scratch0907.7z requires 7zip to unzip it
    • Remember where Node.js is un-zipped
    • Tello.js is used by Node.js to communicate with Tello
    • Tello.s2e is Scratch extension block code that generate specific Tello Blocks
  4. A better version of Tello.s2e has been created by Yiupa. Down it from Git-Hub. https://github.com/yiupa/tello-scratch-extension/tree/English-version Download from Git-hub to replace Tello.s2e with the new Scratch Extension TelloKanji.s2e

Step by Step

  • Start Scratch 2.0. Hold "Shift" key and click "File" menu, then click "Import Experimental HTTP Extension" and select "Tello.s2e" file where you just downloaded. 

  • The Tello interface will be shown in Scratch under "More Blocks". All the Tello command blocks are placed below.

  • First, click "Events" and drag "When green flag clicked" block to the scripting area.

  • Then click "More Blocks" and drag all the blocks to scripting area according the graphic shown below. First, "Takeoff", then "fly up 50cm", "fly forward 50cm", "fly backward 50cm", "flip f", and last "land".  
  • These commands are quite self explanatory. You may change the numbers in the white oval area to change the fly distance.
  • The "flip f" block is tell Tello to perform a flip operation. "f" means forward and you can change to "b" for backward, "l" for left flip, and "r" for right flip.
  • Click "File"->"Save" this script for future use.

  • Next, connect your PC/Mac Wi-Fi to Tello. Usually, the Wi-Fi SSID is "Tello-XXXXXX"
  • Next start Node.js 
    • For PC, open windows command line window and execute node.js (Sorry, I didn't try this on PC)
    • For Mac, open a terminal and go to the directory where you unzipped Tello.js
    • $>cd 
    • $>cd ~/Download/scratch
    • $>~/Download/scratch$ node Tello.js
    • If you see "Data received from server: ok. Received 2 bytes from 192.168.10.1:8889" Means the connection is ok!
  • Click the green flag and your Tello should be able to fly according to the command blocks you placed in the scripting area. Here I try to let Tello to fly in a square and then land.

  • From the terminal, you can see what actions have been performed and Tello responded with "OK". It means the communication is good!

  • You may also show Tello current status in the Scratch stage by click the option box in "More Blocks". See the screenshot below, such as showing height, battery %, and speed...etc.



  • Here is video of Tello followed commands from Scratch to share with you.


    That's it. I hope you enjoyed this tutorial and have a safe flight. 

    END.

====== 中 文 版 (Chinese Version)=========


最近在台灣黑色星期五銷售期間,從網上商店買了一台Tello 無人機! 我很幸運能夠買到 Tello 暢飛套組,包括了 3 個電池和3合1充電器,售價 NT$3400 元! 很超值!
「Tello 3-in-1 charging hub」的圖片搜尋結果
上面的照片來自DJI網站

!!! 請 注 意 !!!

  • 如果這是您第一次嘗試使用Scratch 來控制 Tello,請先在室內中測試程式!
  • 有好幾次,我放置了錯誤的積木指令,Tello 繼續上升並且靠近天花板,我根本無法控制它。 這是由我使用的錯誤指令區塊造成的。 如果那時我在室外,我根本不知道 Tello 會飛往哪裡。

下載必要程式及安裝 

  1. 在Mac或PC上安裝Scratch 2.0 Offline Editor。 從這裡下載:https://scratch.mit.edu/download 這是Scratch程式編輯器。 您將在此編輯器中寫程式來控制Tello。 如果你沒有使用過 Scratch,可以先到這裡熟悉一下 Scratch: https://scratch.mit.edu/projects/editor/?tip_bar=getStarted
  2. 接著從這裡安裝 Node.js: https://nodejs.org/en/
    這是用來模擬 Tello 手機 APP,它可以您將您的PC / Mac與 Tello 連線。 您不需要知道 Node.js 的工作原理,只需運行 Tello.js 程式,Scratch 就可以控制 Tello。
    • 記下  Node.js 安裝的目錄
    • Node.js v10.14.0 安裝在  /usr/local/bin/node
    • npm v6.4.1 to 安裝在 /usr/local/bin/npm
  3. 從下列網址下載 Tello.js 以及 Tello.s2e https://dl-cdn.ryzerobotics.com/downloads/tello/20180910/scratch0907.7z
    • scratch0907.7z 這個檔案需要 7zip 才能解壓縮
    • 請記下 Node.js 及 Tello.js 解壓縮後的檔案位置
    • Node.js 使用 Tello.js 與 Tello 進行連線
    • Tello.s2e 是Scratch 擴展代碼,用來產生特定 Tello 程式區塊
  4. Yiupa 修正了一個更好的 Tello.s2e 版本,你可以從 Git-Hub下載。 https://github.com/yiupa/tello-scratch-extension/tree/English-version

如何使用

  • 啟動 Scratch 2.0程式後,按住 “Shift” 鍵並點選 “File”,然後點 “Import experimental HTTP extension” 接著選擇剛剛下載的 “Tello.s2e”,即可以載入。

  • Scratch 界面將在"More Blocks"下,你可以看到所有的 Tello 命令區塊都放在下面。

  • 首先,點選 "Events" 並將 "When green flag clicked" 塊拖到右方的程式區域。

  • 然後點說"More Blocks"並如下圖所示,將所有你要使用的程式區塊拖動到右方程式區域。這裡我做的範例: 首先,“take off 起飛”,然後“fly up 50 cm”,“fly forward 50cm”,“fly backward 50cm”,“flip f”,最後“land 降落”。 
  • 這些命令非常的簡單易懂,而且您可以更改白色橢圓區域中的數字以變更飛行距離。
  • “Flip f”塊告訴 Tello 執行翻轉。 “f”表示向前,你可以改為“b”表示向後,“l”表示左翻,“r”表示右翻。
  • 最後別忘了點 “File” “Save”將此檔案保存。

  • 接下來,將您的PC / Mac Wi-Fi 連接到 Tello。通常,Tello Wi-Fi SSID 是 “Tello-XXXXXX”
  • 再來是執行 Node.js 
    • 使用PC的朋友,請打開 Command 視窗並執行node.js(對不起,我還沒試過PC,請你試試看)
    • 對於使用 Mac 朋友,請打開終端機並先到你到解壓縮Tello.js的目錄下
    • cd 
    • cd ~/Download/scratch
    • ~/Download/scratch$node Tello.js (執行 紅色指令)
    • 看到 Data received from server: Ok
      Received 2 bytes from 192.168.10:8889 表示連線已完成。
  • 接著,點下綠色𣄃誌,Tello 就應該能夠根據您放在程式區域中的指令區塊進行飛行。 在這裡,我試著讓特洛繞飛一個長方形的路徑,然後降落。

  • 從 Mac 終端機中,您可以看到被執行的區塊指令,Tello 回覆 “OK”。 表示連線沒有問題,指令收到!

  • 如果你點下 "More Blocks" 裡面有很多 Tello 的資訊可以顯示在 Scratch 的畫面裡(Scratch 左側有一雙猫的畫面) 請參閱下面截圖,例如顯示高度,電池百分比和速度等。
    這是我錄下 Tello 依照Scratch的指令飛行的影片,供您參考。

    希望你喜歡這個教學並小心飛行。

2018/11/28

筆記 - 岳母香魯豬腳


香魯豬腳岳母的拿手菜!每次回高雄阿蓮,岳母常常做這道料理。




最近剛好是自己的生日,再過一週就是太太的生日,所以我也來試做看看。
雖然已經做過兩三次,但有時煮起來很成功顏色好看豬腳Q又好吃,有時很好吃,但是顏色又沒那麼好看。所以這次把它紀錄下來,下次參考!

打電話給岳母,她只告訴我,"很簡單,按下面步驟去做就好了"...心情好像不大好...原來她要選的市長這次落選了...

口述做法:
1. 炒二片薑,十來個蒜頭不切,不壓扁下去爆香
2. 炒鍋下醬油,水、冰糖大支䓤段、辣椒
3. 魯約 50分鐘很Q嫩很好吃,或魯到到個人喜好的軟嫩度即可起鍋。

材料:
  • 豬腳一支約2斤半重 (我是傳統市場買,請商家都已去毛用熱水湯過)
  • 薑少許切片
  • 大支䓤段數支
  • 蒜頭十來個
  • 辣椒一個(看喜好程度自行調整)
  • 醬油半碗、水兩碗~三碗
  • 沙拉油少許
  • 黑胡椒少許
  • 冰糖 (必備,顏色好看的重要材料)
詳細做法:
  • 豬腳用熱水川燙再起鍋備用
  • 炒鍋下點沙拉油、二三片薑、十來個蒜頭不切,不壓扁下去爆香
  • 豬腳入炒鍋下去炒,到每面有點焦黄色
  • 下醬油,水、冰糖大支䓤段、辣椒、黑胡椒到鍋內
  • 把豬腳及醬料充份拌勻再蓋上鍋蓋,用小火慢魯..
  • 魯約 50分鐘很Q嫩很好吃,或魯到到個人喜好的軟嫩度即可起鍋。


2018/02/27

Arduino - Switch celling light with TV remote (2/2)

This is the part two of Switch celling light with TV remote tutorial. If needed, please check out the part one from link below. By the way, the source code is also available there.


Quick Link


System Design

See the illustration below. I used a phone charger(purple block; AC110V to DC5V) to supply power from 110v AC power outlet from the celling. The Arduino controls the relay module to switch the celling light and Arduino interpret IR code to change  RGB LED to shift color and on/off accordingly. 

Connections

  • IR Receiver to Arduino pin 2
  • IR Receiver + to VCC
  • IR Receiver - to GND
  • Relay + to VCC
  • Relay - to GND
  • Relay to Arduino pin 8
  • RGB Red to Resistor to Arduino pin 3
  • RGB Green to Resistor to Arduino pin 5
  • RGB Blue to Resistor to Arduino pin 6
  • *** CAUTION: Turn off home main power switch first before 110V connection! ***
  • *** Connect 110V to the system after you secure prefboard to the celling light ***
  • Connect 110V VCC to "Relay NO (Normally Open)" on the left
  • Connect Relay COM (Common connection) to 110V GND. 

      Step by step



      Solder pins to Arduino mini pro.

      Pick up the corner of the perfboard as the fix position. Then, solder pin header connectors on the side of Arduino mini pro, so we could have the flexibility to change wiring later.  Don't forget to face Arduino five data pins towards outside of the prefboard for easier connection to upload source code later.

      Selected few unused solder holes from the Arduino Mini Pro and used the connection pin headers as supporting material on the perfboard. This could prevent unintentional shortage. See below:


      After fixed Arduino Mini Pro in place, solder RGB LED, resistors, and wires to the prefboard. 
      Remember to power up to test the whole setup before moving forward.


      I used a screw to fix the relay module on the perfboard. However, fixed on one side is not stable enough, so I took a cable tight to keep the relay module tightly in place.  *Remember to reserve a very long IR reception wire*, so the IR receiver could placed outside of the celling light or the IR receiver might be obscured by the decorative glass cover.



      Here is the over all system in action!



      Next, find a good power source for the system. 
      For this project, I used a HTC smart phone charger. At least, HTC is (or was?) an international brand name smartphone company and has good reputation regarding to safety. Again, for safety reason, please use certified chargers only, such as CE, FCC, UL from well-know brand name company. *** Do not use no brand or very cheap chargers from unknown source. You are on your own risk! ***



      I used a short USB cable to connect the HTC charger to the system.  Cut the USB cable near micro-B (smaller connector) and strip the shielding off the cable. In there, you will find four wires with GREEN, WHITE, RED, BLACK. Solder the RED(5V+) and BLACK(GND) wires to positive and negative respectively on the perfboard. 

      Cable connection:
      • USB type-A (Larger connector) to HTC charger
      • USB micro-B (smaller connector) to system



      After soldered the USB wires, plug the charger to power outlet and test the system.



      My bedroom celling light looks like this below. It has a switch located at the entrance of the bedroom. And the switch works like this. After implement this system, the control of the switch will be shift to Arduino Mini Pro.

      For every switch on/off, it cycles through 

      1.  Turn on three lights
      2.  Turn off
      3.  Turn on Five lights
      4.  Turn off 
      5.  Turn on two lights
      6.  Turn off



      Carefully loosen the screw from the bottom glass cover and remove the decorative glass away.


      Drill a hole on the light base for tightening the system.


      Use a screw to secure the prefboard to the celling light as shown below.


      *** Important: Wrong connection will cause the light not working ***
      • Connect 110v VCC to "Relay NO (Normally Open)" on the left
      • Connect Relay COM (Common connection) to 110v GND



      When connect AC 110V power line to phone charger, please make sure the isolation is done properly. It would be better to use Heat shrink tube for the isolation. However, I didn't have those on hand, so I used the isolation tape and tight them 3~4 times to ensure it's 100% isolated.  

      *** Disclaimer: Many experts expressed safety concerns for connecting Arduino with relay to AC 110V power!  I'm not responsible for any damage or lose that could happened to your projects or properties! You are at your own risk of doing this! ***



      Before tighten the light frame and decorative glass back to the celling, use the remote to test the system to see if it's working as expected.

      See the red circle below, that's the IR receiver that I used an extended wire from the perfboard to the rim of the light to get better IR reception.



      Let's try to change the color with the TV remote.


      Finally, the project is completed! Watch the video below to see it in action!
      Now I can turn the celling light off directly from my bed after turn TV off!  




      This is the end of this tutorial. I hope you liked it! Please leave comments below and I will see you next time.

      Enjoy!


      2018/02/25

      Arduino - Switch celling light with TV remote (1/2)

       Preface

      It must be happened to you before that in a very cold night watching TV or movie in bed and you were ready for bed. You turned off the TV or DVD player with remote control easily. However, for the celling light, you just had to get out of the bed to turn the light off. What a pain! 

      After I searched the Internet, there are many examples out there suit for this purpose, such as IR receiver, relay module, and RGB LED shift hue and most of them have codes that I could utilize on this project.  

      Quick Link

      Material Needed

      • Arduino mini pro *1 
      • USB upload module *1 
      • Relay module (5V/10A/125V) * 1 
      • IR Receiver LED * 1 (Aixin AX-1838HS 38KHz * 1 / All 38KHz should work) 
      • RGB LED *2 
      • Resister 220 Om * 3
      • Few jump wires
      • Any TV or DVD remote you have at home
      • Breadboard * 1
      It's not difficult to find these components on Amazon or eBay.

      System Functionality

      Assign two buttons on the remote to control the celling light. Remember to assign less frequently used buttons on the remote or you might accidentally activate the particular function on your appliances. :)
      • Button 1: Turn on/off
      • Button 2: Switch LED color hues (static or color shifting)

      Schematic

      This schematic is made with Fritzing. 
      You can download it from its official website: www.fritzing.org


      Connections

      • IR Receiver to Arduino pin 2
      • IR Receiver + to VCC
      • IR Receiver - to GND
      • Relay + to VCC
      • Relay - to GND
      • Relay to Arduino pin 8
      • RGB Red to Resistor to Arduino pin 3
      • RGB Green to Resistor to Arduino pin 5
      • RGB Blue to Resistor to Arduino pin 6

      Check Remote IR code

      You have to find out the remote button IR codes on your remotes and embed them in the source code below for this project to work.


      For Example, my Sanyo TV remote has the following codes. As you can see, I have assigned two buttons for each feature to have a fall back plan.

      • Celling Light Switch function
        • Mute:irCode: 1CE318E7,  bits: 32  sanyoLight1
        • Channel minus :irCode: 1CE3D02F,  bits: 32  sanyoLight2
      • LED Switch function
        • Volume minus :irCode: 1CE3F00F,  bits: 32  sanyoLED1
        • CH View: irCode: 1CE352AD,  bits: 32 sanyoLED2

      To find out the IR codes for you remote, please refer to my previous IR Repeater Tutorial (Part 2)

      Source Code

      /*
       * Author: Stonez56
       * IRRemote for bedroom lighting control 
       *   Light buttons: Switch lights through the 
       *            cycle - 3, 5, 2, off with 2 types of remote
       *   LED buttons: Switch display random color a, b, transistion, off
       */
      
      #include <IRremote.h>
      
      // Setting up pins
      // Setup pin 8 for relay. 
      //    For some reason, Pin 13 will cause relay to switch one time
      //    when system powers on
      const int relay1Pin = 8; 
      const int redPin = 3;                    
      const int greenPin = 5;
      const int bluePin = 6;
      const int irReceiverPin = 2;
      
      // Milisecond to delay when shifting colors
      int colorShiftTime[] = {20, 10, 1, 50}; 
      int colorShiftTimeCounter = 0;
      
      int myPins[] = {2, 4, 8, 3, 6};
      int LEDstatus = 0;       // mode of LED or switch light
                          /*
                           * 0 = LED off
                           * 1 = LED orange
                           * 2 = LED color rotation
                           * 3 = Relay Light swtich
                           */
      
      int relay1Status = 0; // Switch of the relay; either 1 or 0;
      
      
      IRrecv irrecv(irReceiverPin);            
      decode_results results;  // IR decode_results 
      
      unsigned int rgbColour[3]; //RGB LED array
      
      unsigned int preCode = 0x0;  //Previous remote code
      unsigned int currentCode = 0x0; //Current remote code
      
      /* Define remote codes  
      Remote A (iBit Remote)
       Switch
        - (L/R) irCode: 609E09F6,  bits: 32 bitLigth1
        - Subtitle:irCode: 609E8877,  bits: 32  bitLight2
       LED Switch
        - Sound change irCode: 609E42BD,  bits: 32 bitLED1
        - Favorite channel:irCode: 609E728D,  bits: 32 bitLED2
        LED Color speed 
          - colorShiftTime: irCode: 
      
      */
       
      const unsigned long bitLight1 = 0x609E09F6;
      const unsigned long bitLight2 = 0x609E8877;
      const unsigned long bitLED1 = 0x609E42BD;
      const unsigned long bitLED2 = 0x609E728D; 
      const unsigned long bitLEDspeed = 0x609EAA55;
      /*
      Remote B (Sanyo Remote)
       Switch
        - Mute:irCode: 1CE318E7,  bits: 32  sanyoLight1
        - Channel minus :irCode: 1CE3D02F,  bits: 32  sanyoLight2
       LED Switch
        - Volume minus :irCode: 1CE3F00F,  bits: 32  sanyoLED1
        - CH View: irCode: 1CE352AD,  bits: 32 sanyoLED2
        LED Color speed
          - colorShiftTime: irCode: 
      
      */
      const unsigned long sanyoLight1 = 0x1CE318E7;
      const unsigned long sanyoLight2 = 0x1CE3F00F;
      const unsigned long sanyoLED1 = 0x1CE352AD;
      const unsigned long sanyoLED2 = 0x1CE3D02F;
      const unsigned long sanyoLEDspeed = 0x1CE350AF;
      
      void setup()
      {
        
        //////Serial.begin(9600);   
        irrecv.enableIRIn(); // enable IR pin
        pinMode(relay1Pin, OUTPUT);
        // Start off with the LED off.
        ledOff();
      }
      
      // Turn off LED
      void ledOff(){
        rgbColour[0] = 255;
        rgbColour[1] = 255;
        rgbColour[2] = 255;  
        setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
      
        preCode = currentCode;
        while(preCode == currentCode){
              currentCode = checkRemoteCode();
              // Check the code on Serial port
              Serial.print(rgbColour[0]); Serial.print(" | ");
              Serial.print(rgbColour[1]);  Serial.print(" | ");
              Serial.println(rgbColour[2]);
        }
      }
      
      /*
      * Turn on LED to Orange color
      */
      void ledOrange(){
        //LED color orange??
        rgbColour[0] = 65391;
        rgbColour[1] = 400;
        rgbColour[2] = 255;  
        setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
      
        preCode = currentCode;
        while(preCode == currentCode){
              currentCode = checkRemoteCode();
        }
      
      }
      
      
      /*
       * Rotating RGB LED color
       */
      void colorRotation(){
        // Start off with red.
        rgbColour[0] = 0;
        rgbColour[1] = 255;
        rgbColour[2] = 255;  
      
        preCode = currentCode;
       
        // Choose the colours to increment and decrement.
        for (int decColour = 0; decColour < 3; decColour += 1) {
          int incColour = decColour == 2 ? 0 : decColour + 1;
       
          // cross-fade the two colours.
          for(int i = 0; i < 255; i += 1) {
            rgbColour[decColour] -= 1;
            rgbColour[incColour] += 1;   
      
            setColourRgb(rgbColour[0], rgbColour[1], rgbColour[2]);
            delay(colorShiftTime[colorShiftTimeCounter]);
            currentCode = checkRemoteCode();
      
      /*
            Serial.print(" R:");Serial.print(rgbColour[0]);
            Serial.print(" G:");Serial.print(rgbColour[1]);
            Serial.print(" B: ");Serial.println(rgbColour[2]); 
            */     
            //if accepted new remote codes,
            //     exit this function and back to the main loop;
            if(preCode != currentCode){
              return;
            }
          }
        }
      } // End of LED color rotation
      
      
      /* This turn on/off relay switch
       *
       */
      void switchRelay(){
        relay1Status = 1 - relay1Status;   
         if(relay1Status == 0){
          digitalWrite(relay1Pin, HIGH);
          delay(500);
         }else{ 
          digitalWrite(relay1Pin, LOW);
          delay(500);
         }
      }
      
      /* Check remote code and return a mode to be changed
       *
       */
      int checkRemoteCode(){
        if (irrecv.decode(&results)) { // Received IR code and decoded ok!
          // Print to Serial port for debug purposes
          Serial.print("Color shift time: ");
          Serial.print(colorShiftTime[colorShiftTimeCounter]);
          Serial.print("  irCode: ");           
          Serial.print(results.value, HEX);    // IR decode
          Serial.print(",  bits: ");          
          Serial.println(results.bits);        // IR codes
          
          irrecv.resume();                    // Continue to receive next IR code 
          if(results.bits == 32){ //only 32bit code will be evaluated
            switch(results.value){
              /*All these buttons switch lights */ 
              case bitLight1:
              case bitLight2:
              case sanyoLight1:
              case sanyoLight2:  
              case 0x992A2843: //Benq Remote Green button for test
                   LEDstatus = 3; //switch relay;
      
                break;
              case bitLED1:
              case bitLED2:
              case sanyoLED1:
              case sanyoLED2:
                    //Check LEDstatus and switch to next mode
                    LEDstatus += 1;
                    if(LEDstatus >= 3){ 
                        LEDstatus = 0; //LEDstatus only has 0,1,2 if == 3, reset it to 0;
                    }
                break; 
              case bitLEDspeed:
              case sanyoLEDspeed:
                    colorShiftTimeCounter++;
                    if(colorShiftTimeCounter==4){ 
                        colorShiftTimeCounter=1; //only 4 elements, from 0~3
                      }
                    colorShiftTime[colorShiftTimeCounter];
                break;
              default:
                break;        
            } //switch
          } // check 32bits
        } //end of get a remote code
      
        return LEDstatus;
      }
      
      void setColourRgb(unsigned int red, unsigned int green, unsigned int blue) {
        analogWrite(redPin, red);
        analogWrite(greenPin, green);
        analogWrite(bluePin, blue);
       }
      
      void loop(){
        switch(LEDstatus){
           case 0:
              ledOff();
              break;
           case 1:
              ledOrange();
              break;
           case 2:
              colorRotation();
              break;
           case 3:
              switchRelay();
              LEDstatus = 99;
              break;
           default: // set it up to do nothing, but wait the remote code to activate
               break;
        }
        //constanly check new remote code
        LEDstatus = checkRemoteCode();
        //////Serial.print("LEDstatus: ");Serial.println(LEDstatus);
      } // end of loop
      
      
      Here is the prototype in the photo below.



      In next tutorial, I will show you the 2nd phase to put everything together and install the whole system in the celling light.  See you soon!


      2017/12/04

      MIT Scratch Game: Ghoul Buster

      This game, Ghoul Buster, is made by my son Ryan with the MTI Scratch. Ryan is 7th grade now and this was a project he made at school when he was 6th Grade. If you watched to the end, there is a big enemy boss with really powerful thunder weapons to attack the battleship! He is planning to make level 2 of this game.

      I am still trying to convince my son to write a tutorial on how to make this...

      我兒子今年國一,這個遊戲 Ghoul Buster是他在小學六年級時做的。Ryan 使用了MIT Scratch 做了這個遊戲。玩起來有 Arcade 雷電的感覺!如果你有看到最後面,他設計的大魔王有很強大的閃電來功擊玩家的太空船! 目前他還在試著做出第二關。

      目前我正在說服我兒子來寫一篇如何用 Scratch 來做個教學....

      #scratch #scratchgame #mitscratch #minigame #game #kids #coding #programming #kidscoding #kidsprogramming #hourofcode #selfmade #selfmadegame #play #playgame #stonez56 #ryan #yuanryan #yuanryangames