Page 49 - Programming the Photon Getting Started With the Internet of Things
P. 49
Figure 2.8 Example library.
The easiest way to generate boilerplate code is to follow these simple steps:
Step 1: Define a function to create library boilerplate.
Copy and paste the following code into a bash or zsh shell or .profile file:
create_spark_library() {
LIB_NAME=$1
# Make sure a library name was passed
if [ -z "${LIB_NAME}" ]; then
echo "Please provide a library name"