2015-06-20 19:08:28 +00:00
|
|
|
#ifndef ArduinoWifiAgent_H
|
|
|
|
|
#define ArduinoWifiAgent_H
|
2015-06-09 19:19:03 +00:00
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#include "Arduino.h"
|
2015-06-09 19:19:03 +00:00
|
|
|
|
|
|
|
|
// These are the interrupt and control pins
|
|
|
|
|
#define ADAFRUIT_CC3000_IRQ 3 // MUST be an interrupt pin!
|
2015-06-20 19:08:28 +00:00
|
|
|
// These can be any two pins
|
2015-06-09 19:19:03 +00:00
|
|
|
#define ADAFRUIT_CC3000_VBAT 5
|
|
|
|
|
#define ADAFRUIT_CC3000_CS 10
|
|
|
|
|
|
2015-06-22 05:56:07 +00:00
|
|
|
#define WLAN_SSID "SSID" // cannot be longer than 32 characters!
|
|
|
|
|
#define WLAN_PASS "password"
|
2015-06-09 19:19:03 +00:00
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#define WLAN_SECURITY WLAN_SEC_WPA
|
|
|
|
|
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
|
|
|
|
|
#define IDLE_TIMEOUT_MS 3000
|
2015-06-10 00:34:55 +00:00
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#define DEVICE_OWNER "${DEVICE_OWNER}"
|
|
|
|
|
#define DEVICE_ID "${DEVICE_ID}"
|
|
|
|
|
#define DEVICE_TOKEN "${DEVICE_TOKEN}"
|
2015-06-09 19:19:03 +00:00
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#define SERVICE_PORT 9763
|
|
|
|
|
#define SERVICE_EPOINT "/sensebot/controller/"
|
2015-06-11 05:23:04 +00:00
|
|
|
|
2015-06-09 19:19:03 +00:00
|
|
|
#define BUZZER A0
|
|
|
|
|
#define LDR_PIN A1
|
|
|
|
|
#define TEMP_PIN A2
|
|
|
|
|
#define PIR_PIN A3
|
|
|
|
|
#define SONAR_TRIG A4
|
|
|
|
|
#define SONAR_ECHO A5
|
|
|
|
|
|
|
|
|
|
#define BUZZER_SOUND 100
|
|
|
|
|
#define MAX_DISTANCE 30
|
|
|
|
|
|
|
|
|
|
#define TURN_DELAY 100
|
|
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#define PUSH_INTERVAL 30000
|
2015-06-09 19:19:03 +00:00
|
|
|
#define MAX_ACTION 6 // Maximum length of the HTTP action that can be parsed.
|
|
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#define MAX_PATH 10
|
2015-06-09 19:19:03 +00:00
|
|
|
#define BUFFER_SIZE MAX_ACTION + MAX_PATH + 10 // Size of buffer for incoming request data.
|
|
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
#define TIMEOUT_MS 500
|
2015-06-09 19:19:03 +00:00
|
|
|
|
|
|
|
|
#define DEBUG false
|
2015-06-20 19:08:28 +00:00
|
|
|
#define CON_DEBUG false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte server[4] = { 192, 168, 1, 101 };
|
|
|
|
|
String host, jsonPayLoad;
|
|
|
|
|
unsigned long pushTimestamp = 0;
|
|
|
|
|
unsigned long pollTimestamp = 0;
|
|
|
|
|
|
|
|
|
|
#define LISTEN_PORT 80
|
|
|
|
|
|
|
|
|
|
byte motion_global = 0;
|
|
|
|
|
byte temperature = 0;
|
|
|
|
|
int pir =0;
|
|
|
|
|
int sonar=0;
|
|
|
|
|
int ldr =0;
|
|
|
|
|
|
|
|
|
|
const byte motor_left[] = {7, 8};
|
|
|
|
|
const byte enA = 12;
|
|
|
|
|
|
|
|
|
|
const byte motor_right[] = {4, 6};
|
|
|
|
|
const byte enB = 11;
|
|
|
|
|
String urlPath;
|
2015-06-09 19:19:03 +00:00
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2015-06-20 19:08:28 +00:00
|
|
|
|