{
 "format": "mbc-project",
 "target": "spike:pybricks",
 "specVersion": 2,
 "meta": {
  "name": "掌控者PS2 範例4 方向鍵開車",
  "author": "MBC Robot",
  "createdAt": "2026-10-20T00:00:00.000Z",
  "modifiedAt": "2026-10-20T00:00:00.000Z"
 },
 "board": {
  "fqbn": null,
  "displayName": "LEGO SPIKE Prime"
 },
 "workspace": {
  "blocks": {
   "languageVersion": 0,
   "blocks": [
    {
     "type": "arduino_setup",
     "next": {
      "block": {
       "type": "dev_mbc_gamepad__config",
       "fields": {
        "PORT": "C"
       },
       "next": {
        "block": {
         "type": "spike_port_config",
         "fields": {
          "PORT": "E",
          "DEVICE": "lego:motor",
          "DIR": "ccw"
         },
         "next": {
          "block": {
           "type": "spike_port_config",
           "fields": {
            "PORT": "F",
            "DEVICE": "lego:motor",
            "DIR": "cw"
           }
          }
         }
        }
       }
      }
     },
     "x": 40,
     "y": 90
    },
    {
     "type": "arduino_loop",
     "next": {
      "block": {
       "type": "controls_if",
       "extraState": {
        "elseIfCount": 3,
        "hasElse": true
       },
       "inputs": {
        "IF0": {
         "block": {
          "type": "dev_mbc_gamepad_pressed",
          "fields": {
           "PORT": "C",
           "ARG_btn": "0"
          }
         }
        },
        "DO0": {
         "block": {
          "type": "motor_dc",
          "fields": {
           "PORT": "E"
          },
          "inputs": {
           "POWER": {
            "shadow": {
             "type": "math_number",
             "fields": {
              "NUM": 50
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "motor_dc",
            "fields": {
             "PORT": "F"
            },
            "inputs": {
             "POWER": {
              "shadow": {
               "type": "math_number",
               "fields": {
                "NUM": 50
               }
              }
             }
            }
           }
          }
         }
        },
        "IF1": {
         "block": {
          "type": "dev_mbc_gamepad_pressed",
          "fields": {
           "PORT": "C",
           "ARG_btn": "2"
          }
         }
        },
        "DO1": {
         "block": {
          "type": "motor_dc",
          "fields": {
           "PORT": "E"
          },
          "inputs": {
           "POWER": {
            "shadow": {
             "type": "math_number",
             "fields": {
              "NUM": -50
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "motor_dc",
            "fields": {
             "PORT": "F"
            },
            "inputs": {
             "POWER": {
              "shadow": {
               "type": "math_number",
               "fields": {
                "NUM": -50
               }
              }
             }
            }
           }
          }
         }
        },
        "IF2": {
         "block": {
          "type": "dev_mbc_gamepad_pressed",
          "fields": {
           "PORT": "C",
           "ARG_btn": "3"
          }
         }
        },
        "DO2": {
         "block": {
          "type": "motor_dc",
          "fields": {
           "PORT": "E"
          },
          "inputs": {
           "POWER": {
            "shadow": {
             "type": "math_number",
             "fields": {
              "NUM": -30
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "motor_dc",
            "fields": {
             "PORT": "F"
            },
            "inputs": {
             "POWER": {
              "shadow": {
               "type": "math_number",
               "fields": {
                "NUM": 30
               }
              }
             }
            }
           }
          }
         }
        },
        "IF3": {
         "block": {
          "type": "dev_mbc_gamepad_pressed",
          "fields": {
           "PORT": "C",
           "ARG_btn": "1"
          }
         }
        },
        "DO3": {
         "block": {
          "type": "motor_dc",
          "fields": {
           "PORT": "E"
          },
          "inputs": {
           "POWER": {
            "shadow": {
             "type": "math_number",
             "fields": {
              "NUM": 30
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "motor_dc",
            "fields": {
             "PORT": "F"
            },
            "inputs": {
             "POWER": {
              "shadow": {
               "type": "math_number",
               "fields": {
                "NUM": -30
               }
              }
             }
            }
           }
          }
         }
        },
        "ELSE": {
         "block": {
          "type": "motor_dc",
          "fields": {
           "PORT": "E"
          },
          "inputs": {
           "POWER": {
            "shadow": {
             "type": "math_number",
             "fields": {
              "NUM": 0
             }
            }
           }
          },
          "next": {
           "block": {
            "type": "motor_dc",
            "fields": {
             "PORT": "F"
            },
            "inputs": {
             "POWER": {
              "shadow": {
               "type": "math_number",
               "fields": {
                "NUM": 0
               }
              }
             }
            }
           }
          }
         }
        }
       },
       "next": {
        "block": {
         "type": "spike_wait_ms",
         "inputs": {
          "MS": {
           "shadow": {
            "type": "math_number",
            "fields": {
             "NUM": 50
            }
           }
          }
         }
        }
       }
      }
     },
     "x": 40,
     "y": 342
    }
   ]
  },
  "variables": []
 },
 "variables": [],
 "lastFlashedHash": null
}