1
0
Fork 0
mirror of synced 2024-11-12 20:28:58 -05:00
ultimate-vim/sources_non_forked/vim-snippets/snippets/arduino.snippets
2017-02-11 14:01:38 +01:00

124 lines
1.6 KiB
Text

snippet setup
void setup()
{
Serial.begin(${1:9600});
${2}
}
snippet loop
void loop()
{
${0}
}
snippet inc
#include <${1}.h>
snippet def
#define ${1}
# if
snippet if
if (${1:/* condition */}) {
${0:${VISUAL}}
}
# else
snippet el
else {
${1}
}
# else if
snippet elif
else if (${1:/* condition */}) {
${2}
}
# ifi
snippet ifi
if (${1:/* condition */}) ${2};
# 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
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4}
}
# for (custom)
snippet forr
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
${5}
}
# while
snippet wh
while (${1:/* condition */}) {
${2}
}
# do... while
snippet do
do {
${2}
} while (${1:/* condition */});
##
## 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});
# analogRead
snippet ar
analogRead(${1});
# analogWrite
snippet aw
analogWrite(${1});
# serialRead
snippet sr
Serial.read();
# serialWrite
snippet sw
Serial.write();
# serial.print
snippet sp
Serial.print(${1});
# serial.println
snippet sl
Serial.println(${1});
# delay
snippet dl
delay(${1});
# millis
snippet ml
millis();