Page 51 - Programming the Photon Getting Started With the Internet of Things
P. 51

echo " ==> Creating LICENSE"
                touch LICENSE

            fi




            # Create the firmware/examples directory if it doesn't exist

            if [ ! -d "firmware/examples" ]; then
                echo " ==> Creating firmware and firmware/examples directories"
                mkdir -p firmware/examples
            fi





            # Create the firmware .h file if it doesn't exist
            if [ ! -f "firmware/${LIB_NAME}.h" ]; then

                echo " ==> Creating firmware/${LIB_NAME}.h"
                touch firmware/${LIB_NAME}.h
            fi





            # Create the firmware .cpp file if it doesn't exist
            if [ ! -f "firmware/${LIB_NAME}.cpp" ]; then
                echo " ==> Creating firmware/${LIB_NAME}.cpp"

                cat <<EOS > firmware/${LIB_NAME}.cpp
        #include "${LIB_NAME}.h"


        EOS

            fi




            # Create an empty example file if none exists

            if test -z "$(find ./firmware/examples -maxdepth 1 -iname '*' -print -q
        uit)"; then
                echo " ==> Creating firmware/examples/example.cpp"
                cat <<EOS > firmware/examples/example.cpp

        #include "${LIB_NAME}/${LIB_NAME}.h"


        // TODO write code that illustrates the best parts of what your library can
         do



        void setup {


        }
   46   47   48   49   50   51   52   53   54   55   56