Last active
March 24, 2016 17:55
-
-
Save m25lazi/f83688b21ee3e2c34c5c to your computer and use it in GitHub Desktop.
Bloq Example 1 (Control Digital/Analog Arduino pins via Bloq Server)
This file contains 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
/* | |
Should include these additional libraries: | |
* Ethernet | |
* SPI | |
* ArduinoJson by bblanchon (https://github.com/bblanchon/ArduinoJson) | |
Bloq Library includes Arduino-RestClient Library by csquared (https://github.com/csquared/arduino-restclient) | |
Device Type - 0 : Appliance, 1 : Sensor | |
Data Type - 0 : Digital, 1 : Analog | |
*/ | |
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <ArduinoJson.h> | |
#include <Bloq.h> | |
#define BloqDeviceID "-KAotASJuLJ6ZXaFeuYc" | |
#define BloqUserID "-K9r9OuJ4LRc49lE-q7Y" | |
#define BloqDeviceType 0 | |
#define BloqDataType 0 | |
#define BloqSensorPin 3 | |
Bloq theBloq = Bloq(BloqDeviceID, BloqDeviceType, BloqDataType); | |
void setup() { | |
pinMode(BloqSensorPin, OUTPUT); | |
Serial.begin(9600); | |
int bloqStatus = theBloq.init(BloqUserID, BloqSensorPin); | |
while(bloqStatus){} //If bloq init is a failure, no need to proceed | |
} | |
void loop() { | |
theBloq.monitor(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment