Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
966546b4
Commit
966546b4
authored
Feb 22, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added infinite loop block to end arduino program.
parent
47a96cc4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
0 deletions
+28
-0
apps/arduino/arduino_toolbox.xml
apps/arduino/arduino_toolbox.xml
+1
-0
apps/arduino_classic/arduino_toolbox.xml
apps/arduino_classic/arduino_toolbox.xml
+1
-0
blocks/arduino/time.js
blocks/arduino/time.js
+16
-0
generators/arduino/time.js
generators/arduino/time.js
+10
-0
No files found.
apps/arduino/arduino_toolbox.xml
View file @
966546b4
...
...
@@ -144,6 +144,7 @@
</block>
<block
type=
"time_millis"
></block>
<block
type=
"time_micros"
></block>
<block
type=
"infinite_loop"
></block>
</category>
<sep></sep>
<category
name=
"Motors"
>
...
...
apps/arduino_classic/arduino_toolbox.xml
View file @
966546b4
...
...
@@ -136,6 +136,7 @@
</block>
<block
type=
"time_millis"
></block>
<block
type=
"time_micros"
></block>
<block
type=
"infinite_loop"
></block>
</category>
<category
name=
"Motors"
>
<block
type=
"servo_write"
>
...
...
blocks/arduino/time.js
View file @
966546b4
...
...
@@ -100,3 +100,19 @@ Blockly.Blocks['time_micros'] = {
return
'
int
'
;
}
};
Blockly
.
Blocks
[
'
infinite_loop
'
]
=
{
/**
* Waits forever, end of program.
* @this Blockly.Block
*/
init
:
function
()
{
this
.
setHelpUrl
(
''
);
this
.
setColour
(
Blockly
.
Blocks
.
Arduino
.
time
.
HUE
);
this
.
appendDummyInput
()
.
appendField
(
"
wait forever (end program)
"
);
this
.
setInputsInline
(
true
);
this
.
setPreviousStatement
(
true
);
this
.
setTooltip
(
'
Wait indefinitely, stopping the program.
'
);
}
};
generators/arduino/time.js
View file @
966546b4
...
...
@@ -60,3 +60,13 @@ goog.require('Blockly.Arduino');
var
code
=
'
micros()
'
;
return
[
code
,
Blockly
.
Arduino
.
ORDER_ATOMIC
];
};
/**
* Code generator for the wait forever (end of program) block
* Arduino code: loop { while(true); }
* @param {!Blockly.Block} block Block to generate the code from.
* @return {string} Completed code.
*/
Blockly
.
Arduino
[
'
infinite_loop
'
]
=
function
(
block
)
{
return
'
while(true);
'
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment