Oddbean new post about | logout
  Letting #Bitcoin sink in your head might take years but once you see it you can't unsee it  http://res.cloudinary.com/duz6er8nb/image/upload/v1710133252/bef5xikdvwzxvklsomfj.jpg 
 

#include "stm32f4xx_hal.h"
#include "main.h"
#include "task.h"
#include "string.h"
#include "stdio.h"
#include "stdlib.h"

#include "RTO.h"
#include "Lights.h"
#include "TemperatureSensor.h"
#include "PWM.h"
#include "Sensors.h"
#include "Serial.h"
#include "WiFi.h"
#include "HTTPClient.h"
#include "JSON.h"

//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
using namespace std;
namespace HAL = __HAL;
namespace MPLABX = mplabx::f4xx_hal;

//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
#define RTO_PERIOD_SEC 250
#define WIFI_SSID "Kaibutsu-no-Ue"
#define WIFI_PASSWORD "Yaorimon"

//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------

extern MPLABX::I2C i2c1;
extern MPLABX::SPI spi2;

//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
void Error(string msg) {
	Serial.println(msg);
	HAL_Delay(5000);
}

void print_sensors_data(void) {
	Serial.print("Temperature: "); Serial.print(Sensors::temperature);
	Serial.print("
Pressure: "); Serial.print(Sensors::pressure);
	Serial.print("
Humidity: "); Serial.print(Sensors::humidity);
}

//-----------------------------------------------------------------------------------------------
void loop() {
	//Lights::update();
	//TemperatureSensor::update();
	//PWM::set_duty_cycle(50);

	//Task::run();

	if (RTO::isExpired()) {
		print_sensors_data();
		RTO::reset();

		HAL_Delay(100);

		Task::run();
	}

	 HAL_Delay(10);
}