You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

72 lines
1.3 KiB

/*
* Blink
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include <Arduino.h>
#include <nvs_flash.h>
#include "hardware.h"
#include "wifi.h"
//#include "webserver.h"
#include "pusher.h"
#include "shelf.h"
#include "led.h"
#include "coin.h"
#include "MyMQTT.h"
#define LED_BUILTIN 2
using namespace std;
volatile SemaphoreHandle_t xPreferencesSemaphore = xSemaphoreCreateMutex();
Wifi wifi;
//Webserver webserver;
MyMQTT mqtt;
Coin coin;
Pusher pusher;
Shelf* shelf;
Led led;
void setup()
{
Serial.begin(112500);
esp_err_t err = nvs_flash_init();
/* if (err != ESP_OK){
Serial.print("NVS readStruct error @ nvs_init:");
Serial.println(err,HEX);
}*/
Serial.println("Hello");
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
led.setup();
wifi.connect();
mqtt.connect();
// delay(1000);
shelf = new Shelf(8);
pusher.setup();
coin.setup();
// webserver.start();
}
void loop()
{
Serial.print("Free Heap: ");
Serial.println(ESP.getFreeHeap());
// turn the LED on (HIGH is the voltage level)
if (mqtt.connected()) digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(1000);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(1000);
//delay(5000);
}