third_party.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. 'use strict';
  2. goog.provide('Blockly.Blocks.third_party');
  3. goog.require('Blockly.Blocks');
  4. Blockly.Blocks['sonar_setup'] = {
  5. init: function() {
  6. this.appendDummyInput()
  7. .appendField(new Blockly.FieldImage(
  8. // "http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_ultrasonicSensor.png", 140, 40, "15"));
  9. // "http://cocorobo.cn/cocoblockly/blockly/media/sensors-ultrasonic.png", 50, 40, "15"));
  10. "./../blockly/media/sensors-ultrasonic.png", 50, 40, "15"));
  11. this.appendDummyInput()
  12. .appendField(Blockly.Msg.SONAR)
  13. .appendField(new Blockly.FieldDropdown([
  14. ["0", "0"],
  15. ["1", "1"],
  16. ["2", "2"],
  17. ["3", "3"],
  18. ["4", "4"],
  19. ["5", "5"],
  20. ["6", "6"],
  21. ["7", "7"],
  22. ["8", "8"],
  23. ["9", "9"],
  24. ["10", "10"]
  25. ]), "NUMBER")
  26. .appendField(Blockly.Msg.SONAR_SETUP);
  27. this.appendDummyInput()
  28. .appendField(Blockly.Msg.SONAR_SETUP_TRIGPIN)
  29. .appendField(new Blockly.FieldDropdown(
  30. Blockly.Python.Boards.selected.digitalPins.concat(Blockly.Python.Boards.selected.analogPins)), "TRIG_PIN")
  31. .appendField(Blockly.Msg.SONAR_SETUP_ECHOPIN)
  32. .appendField(new Blockly.FieldDropdown(
  33. Blockly.Python.Boards.selected.digitalPins.concat(Blockly.Python.Boards.selected.analogPins)), "ECHO_PIN");
  34. this.appendDummyInput()
  35. .appendField(Blockly.Msg.SONAR_SETUP_MAXDIST)
  36. .appendField(new Blockly.FieldNumber(50), "MAXDIST");
  37. this.setColour(300);
  38. this.setTooltip('');
  39. this.setHelpUrl('');
  40. }
  41. };
  42. Blockly.Blocks['sonar_read_dist'] = {
  43. init: function() {
  44. this.appendDummyInput()
  45. .appendField(Blockly.Msg.SONAR_READ_DIST)
  46. .appendField(Blockly.Msg.SONAR)
  47. .appendField(new Blockly.FieldDropdown([
  48. ["0", "0"],
  49. ["1", "1"],
  50. ["2", "2"],
  51. ["3", "3"],
  52. ["4", "4"],
  53. ["5", "5"],
  54. ["6", "6"],
  55. ["7", "7"],
  56. ["8", "8"],
  57. ["9", "9"],
  58. ["10", "10"]
  59. ]), "NUMBER");
  60. this.setOutput(true, Blockly.Types.NUMBER.output);
  61. this.setColour(300);
  62. this.setTooltip('');
  63. this.setHelpUrl('');
  64. },
  65. getBlockType: function() {
  66. return Blockly.Types.NUMBER;
  67. },
  68. };
  69. Blockly.Blocks['infraredRay_setup'] = {
  70. init: function() {
  71. this.appendDummyInput()
  72. // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_infraredRay.png", 140, 40, "0"));
  73. .appendField(new Blockly.FieldImage("./../blockly/media/sensors-ir_receiver.png", 50, 40, "0"));
  74. this.appendDummyInput()
  75. .appendField(Blockly.Msg.INFRAREDRAY_SETUP);
  76. // this.setNextStatement(true, null);
  77. this.setColour(300);
  78. this.setTooltip('');
  79. this.setHelpUrl('');
  80. }
  81. };
  82. Blockly.Blocks['infraredRay_receive_val'] = {
  83. init: function() {
  84. this.appendDummyInput()
  85. .appendField(Blockly.Msg.INFRAREDRAY_RECVAL);
  86. this.setOutput(true, Blockly.Types.TEXT.output);
  87. this.setColour(300);
  88. this.setTooltip("");
  89. this.setHelpUrl("");
  90. },
  91. getBlockType: function() {
  92. return Blockly.Types.TEXT;
  93. }
  94. };
  95. Blockly.Blocks['infraredRay_send_val'] = {
  96. init: function() {
  97. this.appendDummyInput()
  98. .appendField(new Blockly.FieldDropdown([
  99. ["↑", "KEYPAD_UP"],
  100. ["↓", "KEYPAD_DOWN"],
  101. ["←", "KEYPAD_LEFT"],
  102. ["→", "KEYPAD_RIGHT"],
  103. ["OK", "KEYPAD_OK"],
  104. ["1", "KEYPAD_1"],
  105. ["2", "KEYPAD_2"],
  106. ["3", "KEYPAD_3"],
  107. ["4", "KEYPAD_4"],
  108. ["5", "KEYPAD_5"],
  109. ["6", "KEYPAD_6"],
  110. ["7", "KEYPAD_7"],
  111. ["8", "KEYPAD_8"],
  112. ["9", "KEYPAD_9"],
  113. ["0", "KEYPAD_0"],
  114. ["*", "KEYPAD_STAR"],
  115. ["#", "KEYPAD_NUMSIGN"]
  116. ]), "VALTYPE");
  117. this.setOutput(true, Blockly.Types.TEXT.output);
  118. this.setColour(300);
  119. this.setTooltip("");
  120. this.setHelpUrl("");
  121. },
  122. getBlockType: function() {
  123. return Blockly.Types.TEXT;
  124. }
  125. };
  126. /* RTC
  127. * Setup
  128. */
  129. Blockly.Blocks['RTC_setup'] = {
  130. init: function() {
  131. this.appendDummyInput()
  132. // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_RTC.png", 40, 40, "0"));
  133. .appendField(new Blockly.FieldImage("./../blockly/media/sensors-rtc.png", 50, 40, "0"));
  134. this.appendDummyInput()
  135. .appendField(Blockly.Msg.RTC_SETUP);
  136. this.setColour(340);
  137. this.setTooltip("");
  138. this.setHelpUrl("");
  139. },
  140. };
  141. /* RTC
  142. * Set Date/Time
  143. */
  144. Blockly.Blocks['RTC_setDateTime'] = {
  145. init: function() {
  146. this.appendDummyInput()
  147. .appendField(Blockly.Msg.RTC_SETDATETIME);
  148. this.appendDummyInput()
  149. .appendField(Blockly.Msg.RTC_SETDATE)
  150. .appendField(new Blockly.FieldNumber(2018, 0, 2050), "year")
  151. .appendField("-")
  152. .appendField(new Blockly.FieldNumber(1, 0, 12), "month")
  153. .appendField("-")
  154. .appendField(new Blockly.FieldNumber(1, 0, 31), "day")
  155. this.appendDummyInput()
  156. .appendField(Blockly.Msg.RTC_SETTIME)
  157. .appendField(new Blockly.FieldNumber(12, 0, 24), "hour")
  158. .appendField(":")
  159. .appendField(new Blockly.FieldNumber(30, 0, 60), "minute")
  160. .appendField(":")
  161. .appendField(new Blockly.FieldNumber(10, 0, 60), "second")
  162. this.setPreviousStatement(true);
  163. this.setNextStatement(true);
  164. this.setColour(340);
  165. this.setTooltip("");
  166. this.setHelpUrl("");
  167. },
  168. /**
  169. * Called whenever anything on the workspace changes.
  170. * It checks the number of data and time settting
  171. * @this Blockly.Block
  172. */
  173. onchange: function() {
  174. if (this.getFieldValue("year") > 2050) {
  175. this.setFieldValue("2019", "year");
  176. }
  177. if (this.getFieldValue("month") > 12) {
  178. this.setFieldValue("12", "month");
  179. } else if (this.getFieldValue("month") < 0) {
  180. this.setFieldValue("1", "month");
  181. }
  182. if (this.getFieldValue("day") > 31) {
  183. this.setFieldValue("31", "day");
  184. } else if (this.getFieldValue("day") < 0) {
  185. this.setFieldValue("1", "day");
  186. }
  187. if (this.getFieldValue("hour") > 24) {
  188. this.setFieldValue("24", "hour");
  189. } else if (this.getFieldValue("hour") < 0) {
  190. this.setFieldValue("1", "hour");
  191. }
  192. if (this.getFieldValue("minute") > 60) {
  193. this.setFieldValue("60", "minute");
  194. } else if (this.getFieldValue("minute") < 0) {
  195. this.setFieldValue("1", "minute");
  196. }
  197. if (this.getFieldValue("second") > 60) {
  198. this.setFieldValue("60", "second");
  199. } else if (this.getFieldValue("second") < 0) {
  200. this.setFieldValue("1", "second");
  201. }
  202. }
  203. };
  204. /* RTC
  205. * get Date
  206. */
  207. Blockly.Blocks['RTC_getDate'] = {
  208. init: function() {
  209. this.appendDummyInput()
  210. .appendField(Blockly.Msg.RTC_GETDATE)
  211. .appendField(new Blockly.FieldDropdown([
  212. [Blockly.Msg.RTC_YEAR, "year"],
  213. [Blockly.Msg.RTC_MONTH, "month"],
  214. [Blockly.Msg.RTC_DAY, "day"],
  215. ]), "date_detail")
  216. this.setColour(340);
  217. this.setOutput(true, Blockly.Types.TEXT.output);
  218. this.setTooltip("");
  219. this.setHelpUrl("");
  220. },
  221. getBlockType: function() {
  222. return Blockly.Types.TEXT;
  223. }
  224. };
  225. /* RTC
  226. * get Time
  227. */
  228. Blockly.Blocks['RTC_getTime'] = {
  229. init: function() {
  230. this.appendDummyInput()
  231. .appendField(Blockly.Msg.RTC_GETTIME)
  232. .appendField(new Blockly.FieldDropdown([
  233. [Blockly.Msg.RTC_HOUR, "hour"],
  234. [Blockly.Msg.RTC_MINUTE, "minute"],
  235. [Blockly.Msg.RTC_SECOND, "second"],
  236. ]), "time_detail")
  237. this.setColour(340);
  238. this.setOutput(true, Blockly.Types.TEXT.output);
  239. this.setTooltip("");
  240. this.setHelpUrl("");
  241. },
  242. getBlockType: function() {
  243. return Blockly.Types.TEXT;
  244. }
  245. };
  246. /* RTC
  247. * get Week
  248. */
  249. Blockly.Blocks['RTC_getWeek'] = {
  250. init: function() {
  251. this.appendDummyInput()
  252. .appendField(Blockly.Msg.RTC_GETWEEK);
  253. this.setColour(340);
  254. this.setOutput(true, Blockly.Types.TEXT.output);
  255. this.setTooltip("");
  256. this.setHelpUrl("");
  257. },
  258. getBlockType: function() {
  259. return Blockly.Types.TEXT;
  260. }
  261. };
  262. /* PulseSensor */
  263. Blockly.Blocks['PulseSensor_setup'] = {
  264. init: function() {
  265. this.appendDummyInput()
  266. // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_pulseSensor.png", 40, 40, "0"));
  267. .appendField(new Blockly.FieldImage("./../blockly/media/sensors-heart_beat.png", 50, 40, "0"));
  268. this.appendDummyInput()
  269. .appendField(Blockly.Msg.PULSESENSOR_SETUP)
  270. this.appendDummyInput()
  271. .appendField(Blockly.Msg.PULSESENSOR_SETUP_1)
  272. .appendField(new Blockly.FieldDropdown(Blockly.Python.Boards.selected.analogPins), "PIN");
  273. this.setColour(360);
  274. this.setTooltip("");
  275. this.setHelpUrl("");
  276. },
  277. };
  278. /* PulseSensor */
  279. Blockly.Blocks['PulseSensor_getBPM'] = {
  280. init: function() {
  281. this.appendDummyInput()
  282. .appendField(Blockly.Msg.PULSESENSOR_GETBPM);
  283. this.setOutput(true, Blockly.Types.NUMBER.output);
  284. this.setColour(360);
  285. this.setTooltip("");
  286. this.setHelpUrl("");
  287. },
  288. getBlockType: function() {
  289. return Blockly.Types.NUMBER;
  290. }
  291. }
  292. /* PulseSensor */
  293. Blockly.Blocks['PulseSensor_Heart_Beats'] = {
  294. init: function() {
  295. this.appendDummyInput()
  296. .appendField(Blockly.Msg.PULSESENSOR_HEARTBEAT_WHEN);
  297. this.setOutput(true, Blockly.Types.BOOLEAN.output);
  298. this.setColour(360);
  299. this.setTooltip("");
  300. this.setHelpUrl("");
  301. },
  302. getBlockType: function() {
  303. return Blockly.Types.BOOLEAN;
  304. }
  305. };
  306. /* PulseSensor */
  307. Blockly.Blocks['PulseSensor_Heart_noBeats'] = {
  308. init: function() {
  309. this.appendDummyInput()
  310. .appendField(Blockly.Msg.PULSESENSOR_HEARTBEAT_WHENNO);
  311. this.setOutput(true, Blockly.Types.BOOLEAN.output);
  312. this.setColour(360);
  313. this.setTooltip("");
  314. this.setHelpUrl("");
  315. },
  316. getBlockType: function() {
  317. return Blockly.Types.BOOLEANs;
  318. }
  319. };
  320. /* PulseSensor */
  321. Blockly.Blocks['PulseSensor_print'] = {
  322. init: function() {
  323. this.appendDummyInput()
  324. .appendField(Blockly.Msg.PULSESENSOR_HEARTBEAT_PRINT);
  325. this.setPreviousStatement(true, null);
  326. this.setNextStatement(true, null);
  327. this.setColour(360);
  328. this.setTooltip("");
  329. this.setHelpUrl("");
  330. }
  331. };
  332. /*Encoder*/
  333. Blockly.Blocks['Encoder_Setup'] = {
  334. init: function() {
  335. this.appendDummyInput()
  336. // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_encoder.png", 40, 40, "0"));
  337. .appendField(new Blockly.FieldImage("./../blockly/media/sensors-encoder.png", 50, 40, "0"));
  338. this.appendDummyInput()
  339. .appendField(Blockly.Msg.ENCODER_SETUP)
  340. this.appendDummyInput()
  341. .appendField(Blockly.Msg.ENCODER_SETUP_1)
  342. .appendField(new Blockly.FieldDropdown([
  343. ["2", "2"],
  344. ["3", "3"]
  345. ]), "PIN");
  346. this.setColour(260);
  347. this.setTooltip("");
  348. this.setHelpUrl("");
  349. },
  350. }
  351. /*Encoder*/
  352. Blockly.Blocks['Encoder_getRotationSpeed'] = {
  353. init: function() {
  354. this.appendDummyInput()
  355. .appendField(Blockly.Msg.ENCODER_GETROTATIONSPEED)
  356. this.setOutput(true);
  357. this.setColour(260);
  358. this.setTooltip("");
  359. this.setHelpUrl("");
  360. },
  361. getBlockType: function() {
  362. var numString = '1';
  363. return Blockly.Types.identifyNumber(numString);
  364. }
  365. }
  366. /* RFID
  367. * Setup
  368. */
  369. Blockly.Blocks['RFID_Setup'] = {
  370. init: function() {
  371. this.appendDummyInput()
  372. // .appendField(new Blockly.FieldImage("http://cocorobo.cn/cocoblockly/blockly/media/cocomod_blockly_encoder.png", 40, 40, "0"));
  373. .appendField(new Blockly.FieldImage("./../blockly/media/sensors-rfid.png", 50, 40, "0"));
  374. this.appendDummyInput()
  375. .appendField(Blockly.Msg.RFID_SETUP)
  376. this.setColour(230);
  377. this.setTooltip("");
  378. this.setHelpUrl("");
  379. },
  380. }
  381. /* RFID
  382. * Read ID
  383. */
  384. Blockly.Blocks['RFID_ReadID'] = {
  385. init: function() {
  386. this.appendDummyInput()
  387. .appendField(Blockly.Msg.RFID_READID);
  388. this.setOutput(true, Blockly.Types.TEXT.output);
  389. this.setColour(230);
  390. this.setTooltip("");
  391. this.setHelpUrl("");
  392. },
  393. getBlockType: function() {
  394. return Blockly.Types.TEXT;
  395. }
  396. }
  397. /* GPS
  398. * Setup
  399. */
  400. Blockly.Blocks['GPS_setup'] = {
  401. init: function() {
  402. this.appendDummyInput()
  403. .appendField(new Blockly.FieldImage("./../blockly/media/gps_header.png", 50, 40, "0"));
  404. this.appendDummyInput()
  405. .appendField(Blockly.Msg.GPS_SETUP);
  406. this.setColour(210);
  407. this.setTooltip("");
  408. this.setHelpUrl("");
  409. },
  410. }
  411. /* GPS
  412. * get latitude
  413. */
  414. Blockly.Blocks['GPS_getLatitude'] = {
  415. init: function() {
  416. this.appendDummyInput()
  417. .appendField(Blockly.Msg.GPS_LATITUDE);
  418. this.setOutput(true, Blockly.Types.TEXT.output);
  419. this.setColour(210);
  420. this.setTooltip("");
  421. this.setHelpUrl("");
  422. },
  423. getBlockType: function() {
  424. return Blockly.Types.TEXT;
  425. }
  426. }
  427. /* GPS
  428. * get longitude
  429. */
  430. Blockly.Blocks['GPS_getLongitude'] = {
  431. init: function() {
  432. this.appendDummyInput()
  433. .appendField(Blockly.Msg.GPS_LONGITUDE);
  434. this.setOutput(true, Blockly.Types.TEXT.output);
  435. this.setColour(210);
  436. this.setTooltip("");
  437. this.setHelpUrl("");
  438. },
  439. getBlockType: function() {
  440. return Blockly.Types.TEXT;
  441. }
  442. }
  443. /* Water Temperature Sensor, DS18S20
  444. * setup
  445. */
  446. Blockly.Blocks['water_temp_sensor_setup'] = {
  447. init: function() {
  448. this.appendDummyInput()
  449. .appendField(new Blockly.FieldImage("./../blockly/media/water-temp-sensor-setup.png", 70, 60, "*"));
  450. this.appendDummyInput()
  451. .appendField(Blockly.Msg.WATERTEMP_SETUP_BLOCKNAME);
  452. this.appendDummyInput()
  453. .appendField(Blockly.Msg.WATERTEMP_SETUP_SENSORTYPE)
  454. .appendField(new Blockly.FieldDropdown([
  455. ["DS18S20", "water_temp_sensor_setup_"]
  456. ]), "water_temp_sensor_setup_dropdown")
  457. .appendField(Blockly.Msg.WATERTEMP_SETUP_SETUP);
  458. this.appendDummyInput()
  459. .appendField(Blockly.Msg.WATERTEMP_SETUP_ATTACHED_PIN)
  460. .appendField(new Blockly.FieldNumber(3, 0, 13, 1), "water_temp_sensor_setup_pin");
  461. this.setColour(0);
  462. this.setTooltip("");
  463. this.setHelpUrl("");
  464. }
  465. };
  466. /* Water Temperature Sensor, get value
  467. */
  468. Blockly.Blocks['water_temp_sensor_get_value'] = {
  469. init: function() {
  470. this.appendDummyInput()
  471. .appendField(Blockly.Msg.WATERTEMP_GET_TEMP);
  472. this.setOutput(true, Blockly.Types.DECIMAL.output);
  473. this.setColour(0);
  474. this.setTooltip("");
  475. this.setHelpUrl("");
  476. },
  477. getBlockType: function() {
  478. return Blockly.Types.DECIMAL;
  479. }
  480. };
  481. // CO2 sensor setup
  482. Blockly.Blocks['thirdparty_co2_sensor_setup'] = {
  483. init: function() {
  484. this.appendDummyInput()
  485. .appendField(new Blockly.FieldImage("./../blockly/media/third-party_co2_header.png", 180, 50, { alt: "*", flipRtl: "FALSE" }));
  486. this.appendDummyInput()
  487. .appendField(Blockly.Msg.CO2SENSOR_SETUP);
  488. this.appendDummyInput()
  489. .appendField(Blockly.Msg.CO2SENSOR_SETUP_SDA)
  490. .appendField(new Blockly.FieldDropdown([
  491. ["D2", "D2"]
  492. ]), "thirdparty_co2_sensor_setup_sdapin")
  493. .appendField(Blockly.Msg.CO2SENSOR_SETUP_SCL)
  494. .appendField(new Blockly.FieldDropdown([
  495. ["D3", "D3"]
  496. ]), "thirdparty_co2_sensor_setup_sclpin");
  497. this.setColour(330);
  498. this.setTooltip("");
  499. this.setHelpUrl("https://help.cocorobo.cn/");
  500. }
  501. };
  502. Blockly.Blocks['thirdparty_co2_sensor_get_co2'] = {
  503. init: function() {
  504. this.appendDummyInput()
  505. .appendField(Blockly.Msg.CO2SENSOR_GET_CO2);
  506. this.setOutput(true, null);
  507. this.setColour(330);
  508. this.setTooltip("");
  509. this.setHelpUrl("https://help.cocorobo.cn/");
  510. }
  511. };
  512. Blockly.Blocks['thirdparty_co2_sensor_get_tvoc'] = {
  513. init: function() {
  514. this.appendDummyInput()
  515. .appendField(Blockly.Msg.CO2SENSOR_GET_TVOC);
  516. this.setOutput(true, null);
  517. this.setColour(330);
  518. this.setTooltip("");
  519. this.setHelpUrl("https://help.cocorobo.cn/");
  520. }
  521. };
  522. // nrf module
  523. Blockly.Blocks['thirdparty_nrf24l01_setup'] = {
  524. init: function() {
  525. this.appendDummyInput()
  526. .appendField(new Blockly.FieldImage("./../blockly/media/third-party_nrf-sensor.png", 130, 50, { alt: "*", flipRtl: "FALSE" }));
  527. this.appendDummyInput()
  528. .appendField(Blockly.Msg.NRFMODULE_SETUP_TITLE);
  529. this.appendDummyInput()
  530. .appendField(Blockly.Msg.NRFMODULE_SETUP_CE_TEXT)
  531. .appendField(new Blockly.FieldDropdown([["D7","d7"]]), "thirdparty_nrf24l01_setup_dropdown_cepin")
  532. .appendField(Blockly.Msg.NRFMODULE_SETUP_CSN_TEXT)
  533. .appendField(new Blockly.FieldDropdown([["D5","d5"]]), "thirdparty_nrf24l01_setup_dropdown_csnpin");
  534. this.appendDummyInput()
  535. .appendField(Blockly.Msg.NRFMODULE_SETUP_SET_ADDRESS)
  536. .appendField(new Blockly.FieldTextInput("00001"), "thirdparty_nrf24l01_setup_addr");
  537. this.setColour(230);
  538. this.setTooltip("");
  539. this.setHelpUrl("");
  540. }
  541. };
  542. Blockly.Blocks['thirdparty_nrf24l01_send_data'] = {
  543. init: function() {
  544. this.appendDummyInput()
  545. .appendField(Blockly.Msg.NRFMODULE_SEND_DATA_TITLE);
  546. this.appendDummyInput()
  547. .appendField(Blockly.Msg.NRFMODULE_SEND_DATA_DATA_TEXT)
  548. .appendField(new Blockly.FieldTextInput("Hello World"), "thirdparty_nrf24l01_send_data_data");
  549. this.setPreviousStatement(true, null);
  550. this.setNextStatement(true, null);
  551. this.setColour(230);
  552. this.setTooltip("");
  553. this.setHelpUrl("");
  554. }
  555. };
  556. Blockly.Blocks['thirdparty_nrf24l01_receive_data'] = {
  557. init: function() {
  558. this.appendDummyInput()
  559. .appendField(Blockly.Msg.NRFMODULE_RECEIVING_DATA_TEXT);
  560. this.setPreviousStatement(true, null);
  561. this.setNextStatement(true, null);
  562. this.setColour(230);
  563. this.setTooltip("");
  564. this.setHelpUrl("");
  565. }
  566. };
  567. Blockly.Blocks['thirdparty_nrf24l01_data_received'] = {
  568. init: function() {
  569. this.appendDummyInput()
  570. .appendField(Blockly.Msg.NRFMODULE_GET_RECEIVED_DATA);
  571. this.setOutput(true, null);
  572. this.setColour(230);
  573. this.setTooltip("");
  574. this.setHelpUrl("");
  575. }
  576. };