procedures.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @license Licensed under the Apache License, Version 2.0 (the "License"):
  3. * http://www.apache.org/licenses/LICENSE-2.0
  4. */
  5. /**
  6. * @fileoverview Block for the Arduino functions.
  7. * The Arduino built in functions syntax can be found at:
  8. * https://arduino.cc/en/Reference/HomePage
  9. */
  10. 'use strict';
  11. goog.require('Blockly.Blocks');
  12. /** Common HSV hue for all blocks in this category. */
  13. Blockly.Blocks.procedures.HUE = 340;
  14. Blockly.Blocks['arduino_functions'] = {
  15. /**
  16. * Block for defining the Arduino setup() and loop() functions.
  17. * @this Blockly.Block
  18. */
  19. init: function() {
  20. this.appendDummyInput()
  21. .appendField(Blockly.Msg.ARD_FUN_RUN_SETUP);
  22. this.appendStatementInput('SETUP_FUNC');
  23. // this.appendDummyInput()
  24. // .appendField(Blockly.Msg.ARD_FUN_RUN_LOOP);
  25. // this.appendStatementInput('LOOP_FUNC');
  26. this.setInputsInline(false);
  27. this.setColour(Blockly.Blocks.procedures.HUE);
  28. this.setTooltip(Blockly.Msg.ARD_FUN_RUN_TIP);
  29. this.setHelpUrl('https://arduino.cc/en/Reference/Loop');
  30. this.contextMenu = false;
  31. },
  32. /** @return {!boolean} True if the block instance is in the workspace. */
  33. getArduinoLoopsInstance: function() {
  34. return true;
  35. }
  36. };