My program is a couple of bytes too big
#include <WiFi101.h> // Wifi setup
#include <SPI.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
char ssid[] = "MySpectrumWiFi64-2G"; // your network SSID (name)
char pass[] = "narrowdaisy835"; // your network password
int useWifi = 0; // Use WiFi? 1 = on, 0 = off
int ledFlash = 0;
int buzzer = 0;
int status = WL_IDLE_STATUS;
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
pinMode(9, OUTPUT) ;
pinMode(10, OUTPUT) ;
pinMode(11, OUTPUT) ;
pinMode(12, OUTPUT) ;
if (useWifi == 1) { //Wifi Setup
Serial.print("WiFi Enabled");
WifiIOSetup();
} else {
Serial.print("WiFi Disabled");
}
}
void loop() {
// put your main code here, to run repeatedly:
int temp = 0; // Varibles
int saltLevel = 0;
if (useWifi = 0) {
int8_t ret;
}
saltLevel = analogRead(0); // Detects water voltage
temp = analogRead(1); // Detects temprature
if (temp > 45 && saltLevel < 1000) {
int32_t value = "Pipe Freeze And Hard Water Warning"; // Warning Detection
Serial.print("Pipe Freeze And Hard Water Warning");
digitalWrite(10, LOW);
digitalWrite(11, LOW);
buzzer ++;
} if (temp > 45) {
int32_t value = "Pipe Freeze Warning";
Serial.print("Pipe Freeze Warning");
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
buzzer ++;
} if (saltLevel < 1000) {
int32_t value = "Hard Water Warning";
Serial.print("Hard Water Warning");
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
buzzer ++;
} else {
int32_t value = "No Warnings To Display";
Serial.print("No Warnings To Display");
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
buzzer = 0;
}
Serial.print (" ");
if (buzzer >= 60) { // Buzzer
tone(9,1000);
} else {
noTone(9);
}
if (useWifi == 1) {
if ( status != WL_CONNECTED) { // WiFi Conection
digitalWrite(12, LOW);
} else {
digitalWrite(12, HIGH);
}
} else {
Serial.print (ledFlash);
if (ledFlash == 0) {
digitalWrite(12, LOW);
ledFlash = 1;
} else {
digitalWrite(12, HIGH);
ledFlash = 0;
}
}
delay(500); // Waits 0.5 seconds till next sample
}
int WifiIOSetup() {
status = WiFi.begin(ssid, pass);
int startRepeat = 0;
// wait 10 seconds for connection:
while (startRepeat < 18) {
digitalWrite(10, HIGH); // Startup Prosedure
delay(100);
digitalWrite(10, LOW);
delay(100);
digitalWrite(11, HIGH);
delay(100);
digitalWrite(11, LOW);
delay(100);
digitalWrite(12, HIGH);
delay(100);
digitalWrite(12, LOW);
delay(100);
startRepeat++;
}
Serial.print(WiFi.status());
WiFiClient client;
Adafruit_MQTT_Client mqtt(&client, "io.adafruit.com", 1883, "MaxMaeder", "3754a5c50ec647ab99ae315fcfab09c5");
Adafruit_MQTT_Publish waterHardnesss = Adafruit_MQTT_Publish(&mqtt, "MaxMaeder", "/feeds/water-hardness");
}