123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- 'use strict';
- goog.provide('Blockly.Blocks.time');
- goog.require('Blockly.Blocks');
- goog.require('Blockly.Types');
- Blockly.Blocks.time.HUE = "#fabe23";
- Blockly.Blocks['time_delay'] = {
-
- init: function () {
- this.setHelpUrl('http://arduino.cc/en/Reference/Delay');
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendValueInput('DELAY_TIME_MILI')
-
- .appendField(Blockly.Msg.ARD_TIME_DELAY);
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_MS);
- this.setInputsInline(true);
- this.setPreviousStatement(true, null);
- this.setNextStatement(true, null);
- this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_TIP);
- }
- };
- Blockly.Blocks['time_delaymicros'] = {
-
- init: function () {
- this.setHelpUrl('http://arduino.cc/en/Reference/DelayMicroseconds');
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendValueInput('DELAY_TIME_MICRO')
-
- .appendField(Blockly.Msg.ARD_TIME_DELAY);
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_DELAY_MICROS);
- this.setInputsInline(true);
- this.setPreviousStatement(true, null);
- this.setNextStatement(true, null);
- this.setTooltip(Blockly.Msg.ARD_TIME_DELAY_MICRO_TIP);
- }
- };
- Blockly.Blocks['time_millis'] = {
-
- init: function () {
- this.setHelpUrl('http://arduino.cc/en/Reference/Millis');
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendDummyInput()
-
-
- .appendField(Blockly.Msg.ARD_TIME_MILLIS);
- this.setOutput(true);
- this.setTooltip(Blockly.Msg.ARD_TIME_MILLIS_TIP);
- },
-
- getBlockType: function () {
- return Blockly.Types.LARGE_NUMBER;
- }
- };
- Blockly.Blocks['time_micros'] = {
-
- init: function () {
- this.setHelpUrl('http://arduino.cc/en/Reference/Micros');
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendDummyInput()
-
-
- .appendField(Blockly.Msg.ARD_TIME_MICROS);
- this.setOutput(true);
- this.setTooltip(Blockly.Msg.ARD_TIME_MICROS_TIP);
- },
-
- getBlockType: function () {
- return Blockly.Types.LARGE_NUMBER;
- }
- };
- Blockly.Blocks['infinite_loop'] = {
-
- init: function () {
- this.setHelpUrl('');
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_INF);
- this.setInputsInline(true);
- this.setPreviousStatement(true);
- this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP);
- }
- };
- Blockly.Blocks['time_chrono_setup'] = {
-
- init: function () {
- this.appendDummyInput()
-
- .appendField(new Blockly.FieldImage("./../blockly/media/stopwatch-header.png", 40, 40, "0"));
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_CHRONO_SETUP);
- this.setHelpUrl('');
- this.setColour("#eeaf3c");
- this.setTooltip(Blockly.Msg.ARD_TIME_INF_TIP);
- }
- };
- Blockly.Blocks['time_chrono_reset'] = {
-
- init: function () {
- this.setHelpUrl('');
- this.setColour("#eeaf3c");
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_CHRONO_RESET)
- this.setPreviousStatement(true, null);
- this.setNextStatement(true, null);
- this.setTooltip("");
- }
- };
- Blockly.Blocks['time_chrono_elapsed'] = {
-
- init: function () {
- this.setHelpUrl('');
- this.setColour("#eeaf3c");
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_CHRONO_ELAPSED)
- this.setOutput(true)
- this.setTooltip("");
- }
- };
- Blockly.Blocks['time_chrono_timeCheck'] = {
-
- init: function () {
- this.setHelpUrl('');
- this.setColour("#eeaf3c");
- this.appendValueInput("TIME")
- .appendField(Blockly.Msg.ARD_TIME_CHRONO_CHECK)
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_CHRONO_CHECK1)
- this.setInputsInline(true);
- this.setOutput(true);
- this.setTooltip("");
- }
- };
- Blockly.Blocks['time_everySecond'] = {
- init: function () {
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendValueInput("TIME")
- .appendField(Blockly.Msg.ARD_TIME_EVERY);
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_SECOND);
- this.appendStatementInput("STACK")
- .appendField(Blockly.Msg.ARD_TIME_DO)
-
- this.setPreviousStatement(true);
- this.setNextStatement(true)
- },
- };
- Blockly.Blocks['time_everyMilliSecond'] = {
- init: function () {
- this.setColour(Blockly.Blocks.time.HUE);
- this.appendValueInput("TIME")
- .appendField(Blockly.Msg.ARD_TIME_EVERY_MS);
- this.appendDummyInput()
- .appendField(Blockly.Msg.ARD_TIME_SECOND_MS);
- this.appendStatementInput("STACK")
- .appendField(Blockly.Msg.ARD_TIME_DO_MS)
-
- this.setPreviousStatement(true);
- this.setNextStatement(true)
- },
- };
|