// Define the pins we're going to call pinMode on int led = D1; // This one is the built-in tiny one to the right of the USB jack int blinkLed (String number) ; int buzzer = D5; // This routine runs only once upon reset void setup() { // Initialize D0 + D5 pin as output // It's important you do this here, inside the setup() function rather than outside it or in the loop function. //register fucntion "buzz" to be called over REST pinMode(led, OUTPUT); pinMode(buzzer, OUTPUT); Spark.function("buzz", buzzFunc); } // This routine gets called repeatedly, like once every 5-15 milliseconds. // Spark firmware interleaves background CPU activity associated with WiFi + Cloud activity with your code. // Make sure none of your code delays or blocks for too long (like more than 5 seconds), or weird things can happen. void loop() { } // this is the fucntion invoked by the java code running on the laptop int buzzFunc(String number) { int i = 0; digitalWrite(led, HIGH); // blink on board LED while ( i++<= 6){ //6 short beeps digitalWrite(buzzer, HIGH); delay(100); digitalWrite(buzzer, LOW); Delay(100); } //digitalWrite(led, LOW); // Turn ON the LED return 1; }