1
0
Fork 0
mirror of synced 2024-11-05 08:58:59 -05:00
ultimate-vim/sources_non_forked/vim-snippets/snippets/arduino.snippets

125 lines
1.5 KiB
Text
Raw Normal View History

2015-07-13 06:22:46 -04:00
snippet setup
void setup()
{
2016-11-09 12:22:55 -05:00
Serial.begin(${1:9600});
${2}
2015-07-13 06:22:46 -04:00
}
snippet loop
void loop()
{
${0}
}
snippet inc
#include <${1}.h>
2016-11-09 12:22:55 -05:00
snippet def
#define ${1}
2015-07-13 06:22:46 -04:00
# if
snippet if
if ($1) {
2017-02-11 08:01:38 -05:00
${0:${VISUAL}}
2015-07-13 06:22:46 -04:00
}
# else
snippet el
else {
${1}
}
# else if
snippet elif
else if ($1) {
2015-07-13 06:22:46 -04:00
${2}
}
# ifi
snippet ifi
if ($1) ${2};
2015-07-13 06:22:46 -04:00
# switch
snippet switch
switch (${1:/* variable */}) {
case ${2:/* variable case */}:
${3}
${4:break;}${5}
default:
${6}
}
snippet case
case ${1:/* variable case */}:
${2}
${3:break;}
# for
snippet for
2016-11-09 12:22:55 -05:00
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
2015-07-13 06:22:46 -04:00
${4}
}
# for (custom)
snippet forr
2016-11-09 12:22:55 -05:00
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
2015-07-13 06:22:46 -04:00
${5}
}
# while
snippet wh
while ($1) {
2015-07-13 06:22:46 -04:00
${2}
}
# do... while
snippet do
do {
${2}
} while ($1);
2015-07-13 06:22:46 -04:00
##
## Functions
# function definition
snippet fun
${1:void} ${2:function_name}(${3})
{
${4}
}
## IO
# pinMode OUTPUT
snippet pinout
pinMode(${1}, OUTPUT);
# pinMode INPUT
snippet pinin
pinMode(${1}, INPUT);
# digitalWrite HIGH
snippet dwHigh
digitalWrite(${1}, HIGH);
# digitalWrite LOW
snippet dwLow
digitalWrite(${1}, LOW);
# digitalRead
snippet dr
digitalRead(${1});
2016-11-09 12:22:55 -05:00
# analogRead
snippet ar
analogRead(${1});
# analogWrite
snippet aw
analogWrite(${1});
2015-07-13 06:22:46 -04:00
# serialRead
snippet sr
2016-11-09 12:22:55 -05:00
Serial.read();
# serialWrite
snippet sw
Serial.write();
# serial.print
2015-07-13 06:22:46 -04:00
snippet sp
2016-11-09 12:22:55 -05:00
Serial.print(${1});
# serial.println
snippet sl
Serial.println(${1});
2015-07-13 06:22:46 -04:00
# delay
snippet dl
delay(${1});
2016-11-09 12:22:55 -05:00
# millis
snippet ml
millis();