vim-snippets/snippets/arduino.snippets

108 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-05-16 10:59:48 -04:00
snippet setup
2015-05-18 10:44:24 -04:00
void setup()
{
${0}
Serial.begin(9600);
}
2015-05-16 10:59:48 -04:00
snippet loop
2015-05-18 10:44:24 -04:00
void loop()
{
${0}
}
2015-05-16 10:59:48 -04:00
snippet inc
2015-05-18 10:44:24 -04:00
#include <${1}.h>
2015-05-16 10:59:48 -04:00
# if
snippet if
if (${1:/* condition */}) {
${2}
}
# 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 (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4}
}
# for (custom)
snippet forr
for (${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
2015-05-18 10:44:24 -04:00
pinMode(${1}, OUTPUT);
2015-05-16 10:59:48 -04:00
# pinMode INPUT
snippet pinin
2015-05-18 10:44:24 -04:00
pinMode(${1}, INPUT);
2015-05-16 10:59:48 -04:00
# digitalWrite HIGH
snippet dwHigh
2015-05-18 10:44:24 -04:00
digitalWrite(${1}, HIGH);
2015-05-16 10:59:48 -04:00
# digitalWrite LOW
snippet dwLow
2015-05-18 10:44:24 -04:00
digitalWrite(${1}, LOW);
2015-05-16 10:59:48 -04:00
# digitalRead
snippet dr
2015-05-18 10:44:24 -04:00
digitalRead(${1});
2015-05-16 10:59:48 -04:00
# serialRead
snippet sr
2015-05-18 10:44:24 -04:00
serialRead();
2015-05-16 10:59:48 -04:00
# serial.println
snippet sp
2015-05-18 10:44:24 -04:00
serial.println(${1});
2015-05-16 10:59:48 -04:00
# delay
snippet dl
2015-05-18 10:44:24 -04:00
delay(${1});