first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

View File

@@ -0,0 +1,131 @@
#include "Cube.h"
Cube::Cube(Ecran * _ecran)
{
ecran = _ecran;
}
void Cube::QuickSort(int deb, int fin)
{
int i = deb;
int j = fin;
double milieu = 256 * zface[tri[(deb + fin) / 2]];
int temp;
while (i <= j)
{
while (256 * zface[tri[i]] > milieu) i++;
while (256 * zface[tri[j]] < milieu) j--;
if (i <= j)
{
temp = tri[i];
tri[i] = tri[j];
tri[j] = temp;
i++; j--;
}
}
if (i < fin) QuickSort(i, fin);
if (deb < j) QuickSort(deb, j);
// draw();
}
void Cube::draw()
{
int nb = 0;
while (nb < 200)
{
ecran->LcdClear();
a = a - 0.05;
b = b + 0.05;
for (int n = 0; n < 8; n++) {
lxn[n] = lx[n] * cos(b)
+ ly[n] * sin(a) * sin(b)
+ lz[n] * cos(a) * sin(b);
lyn[n] = ly[n] * cos(a)
- lz[n] * sin(a);
lzn[n] = -lx[n] * sin(b)
+ ly[n] * sin(a) * cos(b)
+ lz[n] * cos(a) * cos(b)
+ 5;
xd[n] = (LCD_X / 2)
+ (LCD_X * lxn[n] * c) / (2 * lzn[n]) * 2;
yd[n] = (LCD_Y / 2)
+ (LCD_Y * lyn[n] * c) / (2 * lzn[n]) * 2;
}
int facev = 0;
for (int m = 0; m < 6; m++) {
znm = (xd[face[m][2]] - xd[face[m][1]]) * (yd[face[m][1]] - yd[face[m][3]]) - (yd[face[m][2]] - yd[face[m][1]]) * (xd[face[m][1]] - xd[face[m][3]]);
//znm=2; only zsorting
if (znm > 0) {
zface[m] = lzn[face[m][0]] + lzn[face[m][1]] + lzn[face[m][2]] + lzn[face[m][3]] + lzn[face[m][4]];
tri[facev] = m;
facev++;
}
}
QuickSort(0, facev - 1);
for (int mb = 0; mb < facev; mb++) {
int color = WHITE;
switch (tri[mb]) {
case 0:
color = WHITE;
break;
case 1:
color = RED;
break;
case 2:
color = BLUE;
break;
case 3:
color = YELLOW;
break;
case 4:
color = GREEN;
break;
case 5:
color = CYAN;
break;
default:
break;
}
points[0].x = xd[face[tri[mb]][0]];
points[0].y = yd[face[tri[mb]][0]];
points[1].x = xd[face[tri[mb]][1]];
points[1].y = yd[face[tri[mb]][1]];
points[2].x = xd[face[tri[mb]][2]];
points[2].y = yd[face[tri[mb]][2]];
points[3].x = xd[face[tri[mb]][3]];
points[3].y = yd[face[tri[mb]][3]];
// FACE 1
ecran->drawFace(
points[0].x, points[0].y,
points[1].x, points[1].y,
points[2].x, points[2].y);
ecran->drawFace(
points[0].x, points[0].y,
points[2].x, points[2].y,
points[3].x, points[3].y);
// ecran->u8g2->drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
// ecran->u8g2->drawLine(points[1].x, points[1].y, points[2].x, points[2].y);
// ecran->u8g2->drawLine(points[2].x, points[2].y, points[0].x, points[0].y);
//
// ecran->u8g2->drawLine(points[0].x, points[0].y, points[2].x, points[2].y);
// ecran->u8g2->drawLine(points[2].x, points[2].y, points[3].x, points[3].y);
// ecran->u8g2->drawLine(points[3].x, points[3].y, points[0].x, points[0].y);
}
ecran->u8g2->sendBuffer();
delay(50);
nb++;
}
}

View File

@@ -0,0 +1,57 @@
#ifndef Cube_h
#define Cube_h
#include <Arduino.h>
#include "Ecran.h"
typedef struct
{
int x, y;
} point;
// Assign human-readable names to some common 16-bit color values:
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
class Cube {
public :
Cube(Ecran * ecran);
void draw();
private:
void QuickSort(int deb, int fin);
public :
float x, y;
private:
Ecran * ecran;
int key;
float a = 0.0, b = 0.0;
//float ax,ay,az;
short lx[8] = {1, 1, 1, 1, -1, -1, -1, -1};
short ly[8] = {1, 1, -1, -1, 1, 1, -1, -1};
short lz[8] = {1, -1, 1, -1, 1, -1, 1, -1};
float lxn[8], lyn[8], lzn[8];
float xd[8], yd[8];
float c = 1.0;
float xt, yt, zt;
float mr[3][3];
float znm;
int face[6][4] = {{4, 0, 1, 5}, {1, 0, 2, 3}, {5, 1, 3, 7}, {4, 5, 7, 6}, {0, 4, 6, 2}, {3, 2, 6, 7}};
int facec[6] = {10, 20, 30, 20, 30, 10};
point points[10];
// Quick sort
int tri[12];
int zface[12];
};
#endif

View File

@@ -0,0 +1,244 @@
#include "Domoticz.h"
Domoticz::Domoticz(String domoticz, String port, const char* ssid, const char* pass)
{
_domoticz = domoticz;
_port = port;
_ssid = ssid;
_pass = pass;
// // Domo
// _domoc[_domoticz.length() + 1];
// _domoticz.toCharArray(_domoc, _domoticz.length() + 1);
//
// // Port
// char portc[_port.length() + 1];
// _port.toCharArray(portc, _port.length() + 1);
// _iport = atoi(portc);
}
boolean Domoticz::connect()
{
// Domo
char _domoc[_domoticz.length() + 1];
_domoticz.toCharArray(_domoc, _domoticz.length() + 1);
// Port
char portc[_port.length() + 1];
_port.toCharArray(portc, _port.length() + 1);
int _iport = atoi(portc);
boolean connected = _client.connect(_domoc, _iport);
Serial.print(_domoc);
Serial.print(" ");
Serial.print(_iport);
Serial.print(" ");
Serial.print(" connected ");
Serial.println(connected);
return connected;
}
void Domoticz::close()
{
}
void Domoticz::initWifi()
{
WiFi.mode(WIFI_AP);
WiFi.begin(_ssid, _pass); //Connect to local Wifi
Serial.println();
Serial.print("Connecting to WiFi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println("WiFi Connected!");
Serial.print("Connexion au reseau ");
Serial.println(WiFi.localIP());
}
String Domoticz::generateKey()
{
// WiFi.mode(WIFI_AP);
// Do a little work to get a unique-ish name. Append the
// last two bytes of the MAC (HEX'd) to "Thing-":
uint8_t mac[WL_MAC_ADDR_LENGTH];
WiFi.softAPmacAddress(mac);
String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) + String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
macID.toUpperCase();
String AP_NameString = "ESP8266 Thing " + macID;
char AP_NameChar[AP_NameString.length() + 1];
memset(AP_NameChar, 0, AP_NameString.length() + 1);
for (int i = 0; i < AP_NameString.length(); i++)
{
AP_NameChar[i] = AP_NameString.charAt(i);
}
// WiFi.softAP(AP_NameChar, WiFiAPPSK);
Serial.println("macID=" + macID);
return macID;
}
void Domoticz::executeJson(String json, String svalue, String nvalue)
{
// Domo
char _domoc[_domoticz.length() + 1];
_domoticz.toCharArray(_domoc, _domoticz.length() + 1);
// Port
char portc[_port.length() + 1];
_port.toCharArray(portc, _port.length() + 1);
int _iport = atoi(portc);
_client.print("GET " + json); //"GET /json.htm?type=command&param=getuservariables");
if (svalue != "") {
_client.print("&svalue=" + svalue);
}
if (nvalue != "") {
_client.print("&nvalue=" + nvalue);
}
_client.println(" HTTP/1.1");
_client.print("Host: ");
_client.print(_domoc);
_client.print(":");
_client.println(_iport);
_client.println("User-Agent: Arduino-ethernet");
_client.println("Connection: close");
_client.println();
}
//--------------------------------------------------------------------------------------------------
// Read current supply voltage
//--------------------------------------------------------------------------------------------------
String Domoticz::readVcc() {
// most exact output
uint16_t v = ESP.getVcc();
float_t v_cal = ((float) v / 1024.0f);
char v_str[10];
dtostrf(v_cal, 5, 3, v_str);
sprintf(v_str, "%s", v_str);
Serial.print("Tension lue ");
Serial.println(String(v_str));
return String(v_str); //ESP.getVcc() / 1024.0f; // Vcc in millivolts
}
String Domoticz::getIndexOfString(String data, String separator, int index)
{
int found = 0;
int strIndex[] = { 0, -1 };
int maxIndex = data.length() - 1;
for (int i = 0; i <= maxIndex && found <= index; i++) {
if (data.charAt(i) == separator.charAt(0) || i == maxIndex) {
found++;
strIndex[0] = strIndex[1] + 1;
strIndex[1] = (i == maxIndex) ? i + 1 : i;
}
}
return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}
String Domoticz::readLine()
{
return _client.readStringUntil('\n');
}
void Domoticz::readTempDayValues(String idx)
{
String json = "/json.htm?type=graph&sensor=temp&idx=" + idx + "&range=day";
int nb = 0;
int nbVal = 0;
Serial.println("readTempDayValues " + idx);
connect();
executeJson(json, "", "");
while (1)
{
String line = readLine();
if (line == "") {
break;
}
if (line.indexOf("\"te\"") != -1) {
//Serial.print(line + " ");
nbVal++;
if (nbVal % 10) {
String val = line.substring(line.indexOf(":") + 2, line.length());
// Serial.println(val);
}
}
nb++;
}
Serial.print("Nombre de lignes ");
Serial.println(nb);
close();
}
void Domoticz::getIdFromDomoticz(String macID, Params * params)
{
String separator = ",";
int nb = 0;
Serial.println("Dans getIdFromDomoticz " + macID);
// -------------------
// LECTURE PARAM
// -------------------
if (params->esp8266_id == "") {
boolean connected = connect();
if (connected) {
Serial.println("Connected to domoticz");
executeJson("/json.htm?type=command&param=getuservariables", "", "");
// Read the first line of the request
while (1) {
String req = readLine();
if (req.indexOf(macID) != -1) {
Serial.println(req);
req = readLine();
req = readLine();
String val = req.substring(req.indexOf(":") + 2, req.length() - 1);
Serial.println(val);
val.replace("\"", "");
params->esp8266_id = getIndexOfString(val, separator, 0);
String tmp = getIndexOfString(val, separator, 1);
char tmpc[tmp.length() + 1];
tmp.toCharArray(tmpc, tmp.length() + 1);
params->sleepTime = atoi(tmpc);
if (params->sleepTime <= 0) {
params->sleepTime = 60;
}
params->esp8266_id_Vcc = getIndexOfString(val, separator, 2);
Serial.println("val1=" + params->esp8266_id);
Serial.print("val2=");
Serial.println(params->sleepTime);
Serial.println("val3=" + params->esp8266_id_Vcc);
break;
}
if (req == "" || nb > 500) {
break;
}
nb++;
}
_client.stop();
delay(100);
}
}
}

View File

@@ -0,0 +1,36 @@
#ifndef Domoticz_h
#define Domoticz_h
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "Params.h"
class Domoticz
{
public:
Domoticz(String domoticz, String port, const char* ssid, const char* pass);
boolean connect();
void close();
void initWifi();
void executeJson(String json, String svalue, String nvalue);
//String getIdFromDomoticz();
String generateKey();
String readLine();
String readVcc();
void readTempDayValues(String idx);
void getIdFromDomoticz(String macID, Params * params);
static String getIndexOfString(String data, String separator, int index);
private:
const char* _ssid;
const char* _pass;
public:
WiFiClient _client;
char _domoc[];
int _iport;
String _domoticz;
String _port;
};
#endif

View File

@@ -0,0 +1,230 @@
//extern "C" {
//#include "user_interface.h"
//}
// Need for getVcc
ADC_MODE(ADC_VCC);
/////////////////////
// Domoticz Classe
/////////////////////
#include "Domoticz.h"
Domoticz domo("192.168.0.10", "8080", "Livebox-37cc", "8A6060920A8A86896F770F2C47");
#include "Modules.h"
Modules modules;
Params * params;
#include "Ecran.h"
Ecran * ecran;
#include "Cube.h"
// Convert image to char array http://www.digole.com/tools/PicturetoC_Hex_converter.php
// Hex values that represent Bitcoin logo
char bitcoin[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x60, 0x70,
0x18, 0x18, 0x18, 0x0C, 0x0C, 0x06, 0x06, 0x06, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x06, 0x06,
0x06, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0x70, 0x60, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x38, 0x1E, 0x07, 0x03,
0x01, 0x80, 0xC0, 0xF0, 0xF8, 0xF8, 0x3E, 0x3E, 0x3E, 0x3F, 0x3F, 0x03, 0x03, 0x03, 0x3F, 0x03,
0x03, 0x03, 0x3F, 0x3F, 0x7F, 0x7E, 0xFE, 0xFE, 0xF8, 0xF8, 0xF0, 0xC0, 0x80, 0x01, 0x03, 0x07,
0x1E, 0x38, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC, 0x1F, 0x03,
0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3E, 0x3E, 0x3E, 0x3E, 0x1C, 0x00, 0x00, 0x00, 0x40, 0xE1, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x03, 0x1F, 0xFC, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x3F, 0xFC, 0xC0, 0x00, 0x00, 0x00, 0x07, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F,
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x3F, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00,
0xC1, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x07, 0x00, 0x00, 0x00, 0xC0, 0xFC, 0x3F, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x1E, 0x3C, 0x60, 0xE0, 0x80, 0x80, 0x03, 0x07,
0x0F, 0x1F, 0x3E, 0x3E, 0x7E, 0x7E, 0x7E, 0x60, 0xE0, 0xE0, 0xFE, 0xE0, 0xE0, 0xE0, 0x7E, 0x7E,
0x7E, 0x7F, 0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x80, 0x80, 0xE0, 0x60, 0x3C, 0x1E, 0x03, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x03, 0x06, 0x06, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0x30, 0x30, 0x30, 0x20, 0x60, 0x60, 0x60,
0x60, 0x20, 0x30, 0x30, 0x30, 0x18, 0x18, 0x18, 0x0C, 0x0C, 0x06, 0x06, 0x03, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
char puma[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x07,0x80,0x00,0x00,0x00,0x00,0x1c,0x00,0x00
,0x00,0x00,0x1f,0xf8,0x00,0x00,0x00,0x00,0x7e,0x00,0x00
,0x00,0x00,0x3f,0xfe,0x00,0x00,0x00,0x00,0xfc,0x00,0x00
,0x00,0x00,0x3f,0xff,0x80,0x00,0x00,0x01,0xf8,0x00,0x00
,0x00,0x00,0x3f,0xff,0xe0,0x00,0x00,0x03,0xc0,0x00,0x00
,0x00,0x00,0x1f,0xff,0xf0,0x00,0x00,0x03,0x80,0x00,0x00
,0x00,0x00,0x01,0xff,0xfc,0x00,0x00,0x07,0x00,0x00,0x00
,0x00,0x00,0x00,0xff,0xfe,0x00,0x00,0x06,0x00,0x00,0x00
,0x00,0x00,0x7f,0xff,0xff,0x80,0x00,0x0c,0x00,0x00,0x00
,0x00,0x00,0x7f,0xff,0xff,0xc0,0x00,0x08,0x00,0x00,0x00
,0x00,0x00,0x77,0xff,0xff,0xf0,0x00,0x18,0x00,0x00,0x00
,0x00,0x00,0x00,0xf9,0xff,0xf8,0x00,0x30,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x7f,0xfe,0x00,0x70,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x3f,0xff,0xc1,0xe0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x0f,0xff,0xff,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x03,0xff,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x0f,0xff,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x80,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x80,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xc0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xe0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
// domoticz
String macID = "";
void setup()
{
Serial.begin(9600);
/* sda scl */
Wire.pins(SDA, SCL);
Wire.begin(SDA, SCL);
// Conversion d'objet en pointeur
Params p;
params = &p;
Ecran e;
ecran = &e;
ecran->LcdBitmap(LCD_X, LCD_Y, bitcoin); // display Bitcoin Logo LCD_X
// ecran->gotoXY(0,0); ecran->LcdString("Init :"); ecran->LcdString(domo._domoticz);
domo.initWifi();
macID = domo.generateKey();
ecran->LcdString(0, 0, domo._domoticz);
ecran->LcdChar(0, 10, "ID : "); ecran->LcdString(40, 10, macID);
ecran->u8g2->sendBuffer();
domo.getIdFromDomoticz(macID, params);
modules.barometre();
//readTemp();
printInfo();
for (int i = 0; i <= 100; i+=10) {
ecran->LcdClear();
ecran->drawRect(1, 1, LCD_X -1, LCD_Y -1);
ecran->drawJauge(10, 24, LCD_X -10, 34, i, "Jauge");
ecran->u8g2->sendBuffer();
delay(100);
}
Cube cube(ecran);
cube.draw();
// Graph g;
// g.title = "Graph";
// g.axe_x = "x";
// g.axe_y = "y";
// Point ps[50];
// for (int i = 0; i < 100; i+=5) {
// Point p(i, i);
// ps[i] = p;
// }
//
// ecran->LcdClear();
// ecran->drawGraph(g);
// ecran->u8g2->sendBuffer();
// ecran->intro();
delay(2000);
// Test Json
domo.readTempDayValues(params->esp8266_id);
// modules.sleep(params->sleepTime);
}
void loop() { }
//void sleepWifi()
//{
// //Time to let the WiFi go to sleep!
// Serial.println("Sleeping...");
// WiFi.disconnect();
// WiFi.mode(WIFI_OFF);
// WiFi.forceSleepBegin(params->sleepTime * 1000000L); //In uS. Must be same length as your delay
// delay(params->sleepTime * 1000); //Hang out at 15mA for 6 seconds
// WiFi.mode(WIFI_STA);
// Serial.println("Awake!");
//}
void printInfo()
{
Serial.println("Dans printInfo " + params->esp8266_id);
boolean connected = domo.connect();
// Domoticz format /json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=TEMP;HUM;HUM_STAT
if (connected && params->esp8266_id != "") {
Serial.println("Dans set temperature");
//domo.executeJson();
String svalue = String(modules.temp) + ";" + String(modules.humidity) + ";0";
// ecran->gotoXY(0,5); ecran->LcdChar("T: "); ecran->LcdString(String(modules.temp));
Serial.println(svalue);
domo.executeJson("/json.htm?type=command&param=udevice&idx=" + params->esp8266_id, svalue, "0");
domo._client.stop();
delay(200);
}
connected = domo.connect();
if (connected && params->esp8266_id_Vcc != "") {
Serial.print(" Envoi tension ");
Serial.print(params->esp8266_id_Vcc);
Serial.print(" ");
String vcc = domo.readVcc();
Serial.println(vcc);
// ecran->gotoXY(0,10); ecran->LcdChar("Vcc:"); ecran->LcdString(vcc);
// domo._client.print("GET /json.htm?type=command&param=udevice&idx=");
domo.executeJson("/json.htm?type=command&param=udevice&idx=" + params->esp8266_id_Vcc, vcc, "0");
domo._client.stop();
}
}

View File

@@ -0,0 +1,203 @@
#include "Ecran.h"
Ecran::Ecran()
{
Serial.println("--------------------------------------");
Serial.println("Init Ecran");
// ECRAN
LcdInitialise();
// LcdClear();
// LcdChar(0, 0, "Starting");
//
// FIN ECRAN
}
// ECRAN Methodes
void Ecran::LcdCharacter(char character)
{
LcdWrite(LCD_D, 0x00);
for (int index = 0; index < 5; index++)
{
LcdWrite(LCD_D, ASCII[character - 0x20][index]);
}
LcdWrite(LCD_D, 0x00);
}
void Ecran::LcdClear(void)
{
u8g2->clearBuffer();
// for (int index = 0; index < LCD_X * LCD_Y / 8; index++)
// {
// LcdWrite(LCD_D, 0x00);
// }
}
void Ecran::LcdInitialise(void)
{
static U8G2_PCD8544_84X48_F_4W_SW_SPI u(U8G2_R0,
/* clock=*/ D5,
/* data=*/ D7,
/* cs=*/ D4,
/* dc=*/ D8,
/* reset=*/ D3); // Nokia 5110 Display
u8g2 = &u;
u8g2->begin();
u8g2->setFont(u8g2_font_6x10_tf);
u8g2->setFontRefHeightExtendedText();
u8g2->setDrawColor(1);
u8g2->setFontPosTop();
u8g2->setFontDirection(0);
setContrast(contrast);
}
void Ecran::LcdChar(int x, int y, char *characters)
{
u8g2->drawStr(x, y, characters);
}
void Ecran::LcdString(int x, int y, String s)
{
char cs[s.length() + 1];
s.toCharArray(cs, s.length() + 1);
LcdChar(x, y, cs);
}
void Ecran::LcdWrite(byte dc, byte data)
{
digitalWrite(PIN_DC, dc);
digitalWrite(PIN_SCE, LOW);
shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
digitalWrite(PIN_SCE, HIGH);
}
void Ecran::setContrast(byte contrast)
{
analogWrite(PIN_LCD, contrast);
}
//This takes a large array of bits and sends them to the LCD
void Ecran::LcdBitmap(int x, int y, char my_array[])
{
for (int index = 0 ; index < (x * y / 8) ; index++)
{
LcdWrite(LCD_DATA, my_array[index]);
}
}
//void Ecran::printInfos()
//{
// // ECRAN
// LcdClear();
// float fractionC;
//
// fractionC = temperature - ((int)temperature);
//
// gotoXY(0,0);
// LcdString("TEMP ");
// itoa(temperature,strBuffer,10);
// LcdString(strBuffer);
// itoa(fractionC,strBuffer,10);
// LcdString(".");
// LcdString(strBuffer);
// LcdString("C ");
//
// fractionC = pression - ((int) pression);
//
// gotoXY(0,10);
// LcdString("Pres ");
// itoa(pression,strBuffer,10);
// LcdString(strBuffer);
// itoa(fractionC,strBuffer,10);
// LcdString(".");
// LcdString(strBuffer);
// LcdString("hp");
//
// fractionC = lux - ((int) lux);
//
// gotoXY(0,20);
// LcdString("Lum ");
// itoa(lux,strBuffer,10);
// LcdString(strBuffer);
// itoa(fractionC,strBuffer,10);
// LcdString(".");
// LcdString(strBuffer);
// LcdString("Lux ");
// // FIN ECRAN
//}
void Ecran::intro()
{
int a = 0;
u8g2->clearBuffer();
u8g2->setFontDirection(0);
LcdChar(0, 0, "Starting");
u8g2->drawStr(30+a,31, " 0");
u8g2->setFontDirection(1);
u8g2->drawStr(30,31+a, " 90");
u8g2->setFontDirection(2);
u8g2->drawStr(30-a,31, " 180");
u8g2->setFontDirection(3);
u8g2->drawStr(30,31-a, " 270");
u8g2->sendBuffer();
delay(500);
const uint8_t frame_size = 24;
u8g2->clearBuffer();
u8g2->drawBox(0, frame_size * 0.5, frame_size * 5, frame_size);
u8g2->drawStr(frame_size * 0.5, 50, "Black");
u8g2->drawStr(frame_size * 2, 50, "White");
u8g2->drawStr(frame_size * 3.5, 50, "XOR");
u8g2->setBitmapMode(false /* solid */);
u8g2->drawStr(0, 0, "Solid bitmap");
u8g2->sendBuffer();
delay(500);
u8g2->clearBuffer();
u8g2->setDrawColor(0);// Black
u8g2->drawXBMP(frame_size * 0.5, 24, cross_width, cross_height, cross_bits);
u8g2->setDrawColor(1); // White
u8g2->drawXBMP(frame_size * 2, 24, cross_width, cross_height, cross_bits);
u8g2->setDrawColor(2); // XOR
u8g2->drawXBMP(frame_size * 3.5, 24, cross_width, cross_height, cross_bits);
u8g2->sendBuffer();
delay(500);
}
void Ecran::drawRect(int x0, int y0, int x1, int y1)
{
u8g2->drawLine(x0, y0, x1, y0);
u8g2->drawLine(x1, y0, x1, y1);
u8g2->drawLine(x1, y1, x0, y1);
u8g2->drawLine(x0, y1, x0, y0);
// u8g2->drawLine(LCD_X / 2, 1, LCD_X / 2, LCD_Y -1);
}
void Ecran::drawJauge(int x0, int y0, int x1, int y1, int val, String text)
{
drawRect(x0, y0, x1, y1);
if (val > 100) {
val = x1;
}
u8g2->drawBox(x0, y0, ((x1 - x0) * val) / 100, y1 - y0);
if (text != "") {
LcdString(x0, y0, text);
}
// u8g2->drawLine(LCD_X / 2, 1, LCD_X / 2, LCD_Y -1);
}
void Ecran::drawFace(int x0, int y0, int x1, int y1, int x2, int y2)
{
u8g2->drawLine(x0, y0, x1, y1);
u8g2->drawLine(x1, y1, x2, y2);
u8g2->drawLine(x2, y2, x0, y0);
}

View File

@@ -0,0 +1,160 @@
#ifndef Ecran_h
#define Ecran_h
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
#include "Pins.h"
#define LCD_C LOW
#define LCD_D HIGH
#define LCD_COMMAND 0
#define LCD_X 84
#define LCD_Y 48
//The DC pin tells the LCD if we are sending a command or data
#define LCD_COMMAND 0
#define LCD_DATA 1
static const byte ASCII[][5] =
{
{0x00, 0x00, 0x00, 0x00, 0x00} // 20
,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 !
,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 "
,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 #
,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $
,{0x23, 0x13, 0x08, 0x64, 0x62} // 25 %
,{0x36, 0x49, 0x55, 0x22, 0x50} // 26 &
,{0x00, 0x05, 0x03, 0x00, 0x00} // 27 '
,{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 (
,{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 )
,{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a *
,{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b +
,{0x00, 0x50, 0x30, 0x00, 0x00} // 2c ,
,{0x08, 0x08, 0x08, 0x08, 0x08} // 2d -
,{0x00, 0x60, 0x60, 0x00, 0x00} // 2e .
,{0x20, 0x10, 0x08, 0x04, 0x02} // 2f backslash
,{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0
,{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1
,{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2
,{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3
,{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4
,{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5
,{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6
,{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7
,{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8
,{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9
,{0x00, 0x36, 0x36, 0x00, 0x00} // 3a :
,{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ;
,{0x08, 0x14, 0x22, 0x41, 0x00} // 3c <
,{0x14, 0x14, 0x14, 0x14, 0x14} // 3d =
,{0x00, 0x41, 0x22, 0x14, 0x08} // 3e >
,{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ?
,{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @
,{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A
,{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B
,{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C
,{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D
,{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E
,{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F
,{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G
,{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H
,{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I
,{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J
,{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K
,{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L
,{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M
,{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N
,{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O
,{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P
,{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q
,{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R
,{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S
,{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T
,{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U
,{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V
,{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W
,{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X
,{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y
,{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z
,{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [
,{0x02, 0x04, 0x08, 0x10, 0x20} // 5c ¥
,{0x00, 0x41, 0x41, 0x7f, 0x00} // 5d ]
,{0x04, 0x02, 0x01, 0x02, 0x04} // 5e ^
,{0x40, 0x40, 0x40, 0x40, 0x40} // 5f _
,{0x00, 0x01, 0x02, 0x04, 0x00} // 60 `
,{0x20, 0x54, 0x54, 0x54, 0x78} // 61 a
,{0x7f, 0x48, 0x44, 0x44, 0x38} // 62 b
,{0x38, 0x44, 0x44, 0x44, 0x20} // 63 c
,{0x38, 0x44, 0x44, 0x48, 0x7f} // 64 d
,{0x38, 0x54, 0x54, 0x54, 0x18} // 65 e
,{0x08, 0x7e, 0x09, 0x01, 0x02} // 66 f
,{0x0c, 0x52, 0x52, 0x52, 0x3e} // 67 g
,{0x7f, 0x08, 0x04, 0x04, 0x78} // 68 h
,{0x00, 0x44, 0x7d, 0x40, 0x00} // 69 i
,{0x20, 0x40, 0x44, 0x3d, 0x00} // 6a j
,{0x7f, 0x10, 0x28, 0x44, 0x00} // 6b k
,{0x00, 0x41, 0x7f, 0x40, 0x00} // 6c l
,{0x7c, 0x04, 0x18, 0x04, 0x78} // 6d m
,{0x7c, 0x08, 0x04, 0x04, 0x78} // 6e n
,{0x38, 0x44, 0x44, 0x44, 0x38} // 6f o
,{0x7c, 0x14, 0x14, 0x14, 0x08} // 70 p
,{0x08, 0x14, 0x14, 0x18, 0x7c} // 71 q
,{0x7c, 0x08, 0x04, 0x04, 0x08} // 72 r
,{0x48, 0x54, 0x54, 0x54, 0x20} // 73 s
,{0x04, 0x3f, 0x44, 0x40, 0x20} // 74 t
,{0x3c, 0x40, 0x40, 0x20, 0x7c} // 75 u
,{0x1c, 0x20, 0x40, 0x20, 0x1c} // 76 v
,{0x3c, 0x40, 0x30, 0x40, 0x3c} // 77 w
,{0x44, 0x28, 0x10, 0x28, 0x44} // 78 x
,{0x0c, 0x50, 0x50, 0x50, 0x3c} // 79 y
,{0x44, 0x64, 0x54, 0x4c, 0x44} // 7a z
,{0x00, 0x08, 0x36, 0x41, 0x00} // 7b {
,{0x00, 0x00, 0x7f, 0x00, 0x00} // 7c |
,{0x00, 0x41, 0x36, 0x08, 0x00} // 7d }
,{0x10, 0x08, 0x08, 0x10, 0x08} // 7e ←
,{0x78, 0x46, 0x41, 0x46, 0x78} // 7f →
};
// DEMO
#define cross_width 24
#define cross_height 24
static const unsigned char cross_bits[] U8X8_PROGMEM = {
0x00, 0x18, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x42, 0x00,
0x00, 0x42, 0x00, 0x00, 0x42, 0x00, 0x00, 0x81, 0x00, 0x00, 0x81, 0x00,
0xC0, 0x00, 0x03, 0x38, 0x3C, 0x1C, 0x06, 0x42, 0x60, 0x01, 0x42, 0x80,
0x01, 0x42, 0x80, 0x06, 0x42, 0x60, 0x38, 0x3C, 0x1C, 0xC0, 0x00, 0x03,
0x00, 0x81, 0x00, 0x00, 0x81, 0x00, 0x00, 0x42, 0x00, 0x00, 0x42, 0x00,
0x00, 0x42, 0x00, 0x00, 0x24, 0x00, 0x00, 0x24, 0x00, 0x00, 0x18, 0x00, };
class Ecran
{
public:
Ecran();
void drawFace(int x0, int y0, int x1, int y1, int x2, int y2);
void drawRect(int x0, int y0, int x1, int y1);
void drawJauge(int x0, int y0, int x1, int y1, int val, String text);
void intro();
void LcdWrite(byte dc, byte data);
void LcdChar(int x, int y, char *characters);
void LcdString(int x, int y, String s);
void LcdInitialise(void);
void LcdClear(void);
void LcdBitmap(int x, int y,char my_array[]);
void LcdCharacter(char character);
void setContrast(byte contrast);
private:
public:
long contrast = 200;
U8G2_PCD8544_84X48_F_4W_SW_SPI * u8g2;
};
#endif

View File

@@ -0,0 +1,35 @@
#include "Graph.h"
Graph::Graph(Ecran * _ecran, int _x0, int _y0 ,int _x1, int _y1)
{
Serial.println("--------------------------------------");
Serial.println("Init Graph");
x0 = _x0;
x1 = _x1;
y0 = _y0;
y1 = _y1;
ecran = _ecran;
}
void Graph::drawAxes()
{
ecran->u8g2->drawLine(x0 + 5, y0 + 5, x1, y0 + 5);
ecran->u8g2->drawLine(x0 + 5, y0 + 5, x0 + 5, y1);
}
void Graph::drawTitle()
{
if (title != "") {
ecran->LcdString(x0, y0, title);
}
}
void Graph::drawDatas()
{
}
void Graph::drawGraph()
{
drawAxes();
drawTitle();
drawDatas();
}

View File

@@ -0,0 +1,21 @@
#ifndef Graph_h
#define Graph_h
#include <Arduino.h>
#include "Ecran.h"
#include "Point.h"
class Graph {
public :
Graph(Ecran * ecran, int x0, int y0 ,int x1, int y1);
void drawAxes();
void drawTitle();
void drawDatas();
void drawGraph();
public :
Ecran * ecran;
int x0, y0,x1, y1;
String title, axe_x, axe_y;
Point datas[];
};
#endif

View File

@@ -0,0 +1,98 @@
#include "Modules.h"
// int status = WL_IDLE_STATUS; // the Wifi radio's status
//WiFiClient client;
// Dallas
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
// Initialize DHT sensor for normal 16mhz Arduino
DHT dht(DHTPIN, DHTTYPE);
Modules::Modules()
{
}
void Modules::readTemp()
{
//DS18B20.begin();
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
Serial.print("Temperature: ");
Serial.println(temp);
}
void Modules::barometre() {
/* See Example: TypeA_WithDIPSwitches */
delay(500);
Serial.print("Barometre: ");
//Serial.println(bmp.begin());
// BMP
if (bmp.begin()) {
delay(1000);
temp = bmp.readTemperature();
pressure = bmp.readPressure() / 100.0;
pression = pressure / 101.325;
pression = pression * 0.760 * 100;
// http://en.wikipedia.org/wiki/Atmospheric_pressure#Mean_sea_level_pressure
// Serial.print("Presiure la nivelul marii (calculata) = ");
presiune = bmp.readSealevelPressure(ALTITUDE) / 101.325;
presiune = presiune * 0.760;
Serial.print("Temperature="); Serial.println(temp);
Serial.print("pressure="); Serial.println(pressure);
Serial.print("pression="); Serial.println(pression);
}
}
void Modules::sleep(int sleepTime)
{
Serial.print("Go to sleep ");
Serial.println(sleepTime);
delay(20);
ESP.deepSleep(sleepTime * 1000000L); // Infini
//sleepWifi();
delay(200);
}
void Modules::readDht()
{
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
humidity = dht.readHumidity();
// Read temperature as Celsius
temp = dht.readTemperature();
// Read temperature as Fahrenheit
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(humidity) || isnan(temp) || isnan(f)) {
// Serial.println("Failed to read from DHT sensor!");
return;
} else {
// Compute heat index
// Must send in temp in Fahrenheit!
float hi = dht.computeHeatIndex(f, humidity);
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temp);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hi);
Serial.println(" *F");
}
}

View File

@@ -0,0 +1,36 @@
#ifndef Modules_h
#define Modules_h
#include <Arduino.h>
#include <Adafruit_BMP085.h>
#include <DallasTemperature.h>
#include "DHT.h"
#include "Pins.h"
// ################# Barometre ####
#define ALTITUDE 19.0 // Altitude of SparkFun's HQ in Boulder, CO. in meters
#define DHTTYPE DHT11 // DHT 11
//SFE_BMP180 pressure;
// #####################
class Modules
{
public:
Modules();
void readTemp();
void barometre();
void readDht();
void sleep(int sleepTime);
private:
public:
Adafruit_BMP085 bmp;
double humidity = 0;
double temp = 0;
double pression = 0;
double pressure = 0;
double presiune = 0;
};
#endif

View File

@@ -0,0 +1,7 @@
#include "Params.h"
Params::Params()
{
}

View File

@@ -0,0 +1,15 @@
#ifndef Params_h
#define Params_h
#include <Arduino.h>
class Params {
public :
Params();
public :
String esp8266_id;
String esp8266_id_Vcc;
int sleepTime;
};
#endif

View File

@@ -0,0 +1,20 @@
#ifndef Pins_h
#define Pins_h
#include <Arduino.h>
#define SDA D1
#define SCL D2
#define ONE_WIRE_BUS 10 // DS18B20 pin
#define DHTPIN 11 // what pin we're connected to
// Ecran
#define PIN_RESET D3
#define PIN_SCE D4
#define PIN_DC D8
#define PIN_SDIN D7
#define PIN_SCLK D5
#define PIN_LCD D6 // backlight
//#define PIN_FADER 1 // analog
//#define PIN_TMP 0 // analog
#endif

View File

@@ -0,0 +1,7 @@
#include "Point.h"
Point::Point(int _x, int _y)
{
x = _x;
y = _y;
}

View File

@@ -0,0 +1,15 @@
#ifndef Point_h
#define Point_h
#include <Arduino.h>
class Point {
public :
Point(int _x, int _y);
public :
float x, y;
};
#endif