From: rtrimana Date: Thu, 10 May 2018 21:18:38 +0000 (-0700) Subject: Testing different functions. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;ds=sidebyside;h=c3f794458b64e29a1dd83dae87d3e3a96b7a1d28;p=iotcloud.git Testing different functions. --- diff --git a/version2/src/others/functions/Makefile b/version2/src/others/functions/Makefile new file mode 100644 index 0000000..cfdcdb0 --- /dev/null +++ b/version2/src/others/functions/Makefile @@ -0,0 +1,41 @@ +include common.mk + +all: compile + +# To run Particle, we need to install Particle CLI +# Please see: +# https://docs.particle.io/guide/getting-started/connect/photon/#install-the-particle-cli +monitor: + sudo chmod 666 /dev/ttyACM0 + particle serial monitor + +compile: + rm -f *.bin + #particle compile photon + particle compile raspberry-pi + +flash: + particle flash Pi-1 raspberry-pi*.bin + +flash0: + particle flash IoT-0 photon*.bin + +flash1: + particle flash IoT-1 photon*.bin + +PHONY += clean +clean: + rm -f *.bin + +PHONY += mrclean +mrclean: clean + rm -rf ../docs + +tabbing: + uncrustify -c C.cfg --no-backup *.cpp + uncrustify -c C.cfg --no-backup *.h + +wc: + wc *.cpp *.h + +.PHONY: $(PHONY) diff --git a/version2/src/others/functions/common.mk b/version2/src/others/functions/common.mk new file mode 100644 index 0000000..479a31c --- /dev/null +++ b/version2/src/others/functions/common.mk @@ -0,0 +1,16 @@ +# A few common Makefile items + +CC := gcc +CXX := g++ + +UNAME := $(shell uname) + +LIB_NAME := iotcloud +LIB_SO := lib_$(LIB_NAME).so + +CPPFLAGS += -Wall -g -O0 + +# Mac OSX options +ifeq ($(UNAME), Darwin) +CPPFLAGS += -D_XOPEN_SOURCE -DMAC +endif diff --git a/version2/src/others/functions/functions.ino b/version2/src/others/functions/functions.ino new file mode 100644 index 0000000..db813ef --- /dev/null +++ b/version2/src/others/functions/functions.ino @@ -0,0 +1,46 @@ +// ------------------------------------------------ +// Test on function subscriptions +// @author Rahmadi Trimananda - UC Irvine +// ------------------------------------------------ + +// Setting up pins for input +void setup() { + + Particle.function("12345678901",functionOne); + Particle.function("123456789012", functionTwo); + Particle.function("123", functionThree); + Particle.function("1234", functionFour); + Particle.function("12345", functionFive); +} + +void loop() { + + // Do nothing +} + + +int functionOne(String integer) { + + return 1234; +} + +int functionTwo(String command) { + + return 1234; +} + +int functionThree(String command) { + + return 1234; +} + +int functionFour(String command) { + + return 12345678; +} + +int functionFive(String command) { + + return 1234567812345678; +} + diff --git a/version2/src/others/functions/raspberry-pi_firmware_1525986044817.bin b/version2/src/others/functions/raspberry-pi_firmware_1525986044817.bin new file mode 100644 index 0000000..8f30bc3 Binary files /dev/null and b/version2/src/others/functions/raspberry-pi_firmware_1525986044817.bin differ