@@ -1941,12 +1941,18 @@ Blockly.Blocks['adxl345_on'] = {
19411941} ;
19421942
19431943Blockly . Blocks [ 'adxl345_val' ] = {
1944- init : function ( ) {
1944+ init : function ( ) {
19451945 this . appendDummyInput ( )
1946- . appendField ( new Blockly . FieldVariable ( "adxl" ) , "name_" )
1947- . appendField ( "的" )
1948- . appendField ( new Blockly . FieldDropdown ( [ [ "x" , "_x" ] , [ "y" , "_y" ] , [ "z" , "_z" ] , [ "roll" , "_r" ] , [ "pitch" , "_p" ] ] ) , "val_" )
1949- . appendField ( "數值" ) ;
1946+ . appendField ( new Blockly . FieldVariable ( "adxl" ) , "name_" )
1947+ . appendField ( "的" )
1948+ . appendField ( new Blockly . FieldDropdown ( [
1949+ [ "x" , "_x" ] ,
1950+ [ "y" , "_y" ] ,
1951+ [ "z" , "_z" ] ,
1952+ [ "roll" , "_r" ] ,
1953+ [ "pitch" , "_p" ]
1954+ ] ) , "val_" )
1955+ . appendField ( "數值" ) ;
19501956 this . setOutput ( true ) ;
19511957 this . setTooltip ( '' ) ;
19521958 this . setColour ( 65 ) ;
@@ -1966,3 +1972,93 @@ Blockly.Blocks['adxl345_off'] = {
19661972 this . setHelpUrl ( 'http://www.example.com/' ) ;
19671973 }
19681974} ;
1975+
1976+
1977+ Blockly . Blocks [ 'joystick_new' ] = {
1978+ init : function ( ) {
1979+ this . appendDummyInput ( )
1980+ . appendField ( "搖桿,X" )
1981+ . appendField ( new Blockly . FieldDropdown ( [
1982+ [ "A0" , "0" ] ,
1983+ [ "A1" , "1" ] ,
1984+ [ "A2" , "2" ] ,
1985+ [ "A3" , "3" ] ,
1986+ [ "A4" , "4" ] ,
1987+ [ "A5" , "5" ]
1988+ ] ) , "vrx_" )
1989+ . appendField ( " Y" )
1990+ . appendField ( new Blockly . FieldDropdown ( [
1991+ [ "A0" , "0" ] ,
1992+ [ "A1" , "1" ] ,
1993+ [ "A2" , "2" ] ,
1994+ [ "A3" , "3" ] ,
1995+ [ "A4" , "4" ] ,
1996+ [ "A5" , "5" ]
1997+ ] ) , "vry_" )
1998+ . appendField ( " SW" )
1999+ . appendField ( new Blockly . FieldDropdown ( [
2000+ [ "2" , "2" ] ,
2001+ [ "3" , "3" ] ,
2002+ [ "4" , "4" ] ,
2003+ [ "5" , "5" ] ,
2004+ [ "6" , "6" ] ,
2005+ [ "7" , "7" ] ,
2006+ [ "8" , "8" ] ,
2007+ [ "9" , "9" ] ,
2008+ [ "10" , "10" ] ,
2009+ [ "11" , "11" ] ,
2010+ [ "12" , "12" ] ,
2011+ [ "13" , "13" ]
2012+ ] ) , "sw_" ) ;
2013+ this . setOutput ( true ) ;
2014+ this . setColour ( 230 ) ;
2015+ this . setTooltip ( '' ) ;
2016+ this . setHelpUrl ( 'http://www.example.com/' ) ;
2017+ }
2018+ } ;
2019+
2020+ Blockly . Blocks [ 'joystick_on' ] = {
2021+ init : function ( ) {
2022+ this . appendDummyInput ( )
2023+ . appendField ( new Blockly . FieldVariable ( "joystick" ) , "name_" )
2024+ . appendField ( "開始偵測" ) ;
2025+ this . appendStatementInput ( "on_" )
2026+ . appendField ( "執行:" ) ;
2027+ this . setPreviousStatement ( true ) ;
2028+ this . setNextStatement ( true ) ;
2029+ this . setColour ( 65 ) ;
2030+ this . setTooltip ( '' ) ;
2031+ this . setHelpUrl ( 'http://www.example.com/' ) ;
2032+ }
2033+ } ;
2034+
2035+ Blockly . Blocks [ 'joystick_val' ] = {
2036+ init : function ( ) {
2037+ this . appendDummyInput ( )
2038+ . appendField ( new Blockly . FieldVariable ( "joystick" ) , "name_" )
2039+ . appendField ( "的" )
2040+ . appendField ( new Blockly . FieldDropdown ( [
2041+ [ "X" , "_x" ] ,
2042+ [ "Y" , "_y" ] ,
2043+ [ "SW" , "_z" ]
2044+ ] ) , "val_" )
2045+ . appendField ( "數值" ) ;
2046+ this . setOutput ( true ) ;
2047+ this . setTooltip ( '' ) ;
2048+ this . setColour ( 65 ) ;
2049+ this . setHelpUrl ( 'http://www.example.com/' ) ;
2050+ }
2051+ } ;
2052+
2053+ Blockly . Blocks [ 'joystick_off' ] = {
2054+ init : function ( ) {
2055+ this . appendDummyInput ( )
2056+ . appendField ( new Blockly . FieldVariable ( "joystick" ) , "name_" )
2057+ . appendField ( "停止偵測" ) ;
2058+ this . setPreviousStatement ( true ) ;
2059+ this . setNextStatement ( true ) ;
2060+ this . setColour ( 65 ) ;
2061+ this . setTooltip ( '' ) ;
2062+ this . setHelpUrl ( 'http://www.example.com/' ) ;
2063+ }
2064+ } ;
0 commit comments