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
| void postRange() { | |
| String data = "{\"deviceId\": \"" + String(device_id) | |
| + "\", \"time\": " + String(time(nullptr)) + ", \"range\": \"" + | |
| String(getRangeCm(), DEC) + " cm\", \"scanId\": \""+ String(scanId) + | |
| "\", \"scanAngle\": \"" + String(HEXBUG_ROT % 360) + " deg\"}"; | |
| sendTelemetry(data); | |
| Serial.println(data); | |
| } | |
| // Test surroundings |
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
| int getHexConfig () { | |
| WiFiClientSecure client; | |
| doRequest(&client, true, ""); | |
| int toReturn = -1; | |
| while (client.available()) { | |
| String line = client.readStringUntil('\n'); | |
| Serial.println(line); | |
| // NOTE: This method and the following are character length sensitive | |
| if (line.indexOf("version\": \"") > 0) { |
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
| void loop(void) { | |
| unsigned long currTime = millis(); | |
| if (!booted){ | |
| bootLoop(); | |
| } | |
| if (hasStrip){ | |
| blinkyLoop(moveConfig ); | |
| } |
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
| void setup() { | |
| Serial.begin(115200); | |
| delay(1000); | |
| Serial.println("Hello, waiting..."); | |
| delay(5000); | |
| pinMode(LED_BUILTIN, OUTPUT); | |
| digitalWrite(LED_BUILTIN, HIGH); |
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
| int MQ7_APIN = A3, int MQ7_DPIN = 8; | |
| float readMQ7() { | |
| float value = analogRead(MQ7_APIN); | |
| //int limit = digitalRead(MQ7_DPIN) | |
| return value; | |
| } |
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
| void loop() { | |
| char buf[12]; | |
| float mq = readMQ7(); | |
| sprintf(buf, "%f", mq); | |
| Serial.println("" + String(buf)); | |
| sendTelemetry("" + String(buf)); | |
| delay(60000); | |
| } |
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
| // Based on instructions at: | |
| // http://www.instructables.com/id/How-to-Interface-With-Optical-Dust-Sensor/ | |
| int measurePin = A3; int ledPower = 12; int samplingTime = 280;int deltaTime = 40; | |
| int sleepTime = 9680; float voMeasured = 0; float calcVoltage = 0; | |
| float dustDensity = 0; | |
| float readDust(){ | |
| digitalWrite(ledPower,LOW); // power on the LED | |
| delayMicroseconds(samplingTime); | |
| voMeasured = analogRead(measurePin); // read the dust value |
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
| gcloud pubsub subscriptions pull <your-project-id> --limit 50 --auto-ack |
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
| git clone https://github.com/googlecloudplatform/google-cloud-iot-arduino |
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
| openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem | |
| openssl ec -in ec_private.pem -pubout -out ec_public.pem |