Skip to content

Instantly share code, notes, and snippets.

@staceymakes
Created November 20, 2014 21:21
Show Gist options
  • Save staceymakes/49a1ee4e8a03b8858b88 to your computer and use it in GitHub Desktop.
Save staceymakes/49a1ee4e8a03b8858b88 to your computer and use it in GitHub Desktop.
Calling Spark Cloud API on Interval and starting Babylon.js Particle system
setInterval(function(){
$.ajax("https://api.spark.io/v1/devices/{YOUR_SPARK_ID}/pressure?access_token={YOUR_ACCESS_TOKEN}")
.done(function(obj){
if(obj.result < 10){
scene.particleSystem.start();
}else{
scene.particleSystem.stop();
}
})
},1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment