Last active
September 30, 2016 05:10
-
-
Save pfeerick/da9bec46d17fad1e881c8599dfa9542c to your computer and use it in GitHub Desktop.
Just s simple script to test some particle stuff on the Oak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Just s simple script to test some particle stuff on the Oak | |
| */ | |
| // this makes the Oak only automatically connect to wifi, not particle | |
| SYSTEM_MODE(SEMI_AUTOMATIC) | |
| // the setup function runs once when you reset or power the board | |
| void setup() | |
| { | |
| // initialize digital pin 1 as an output. | |
| pinMode(1, OUTPUT); | |
| //do some blinks before the particle connection is started | |
| for (int i = 0; i < 5; i++) | |
| { | |
| digitalWrite(1, HIGH); // turn the LED on | |
| delay(500); // wait | |
| digitalWrite(1, LOW); // turn the LED off | |
| delay(500); // wait | |
| } | |
| //connect to particle | |
| if (Particle.connected() == false) { | |
| Particle.connect(); | |
| } | |
| //proudly state on particle that "It's alive!" | |
| Particle.publish("event", "Oak is connected to Particle!", PRIVATE); | |
| } | |
| // the loop function runs over and over again forever | |
| void loop() | |
| { | |
| //make the led blink every ~10 seconds | |
| digitalWrite(1, HIGH); // turn the LED on | |
| delay(500); // wait | |
| digitalWrite(1, LOW); // turn the LED off | |
| Particle.publish("event", "Oak LED has blinked!", PRIVATE); | |
| delay(9500); // wait | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment