155 changed files with 56338 additions and 21736 deletions
@ -1,36 +0,0 @@ |
|||
|
|||
void getWind() { |
|||
|
|||
windDirection = ""; |
|||
anemometerVal = digitalRead(anemometerPin); |
|||
|
|||
if ((anemometerState == 1) && (anemometerVal == 0)) { |
|||
anemometerDuration = millis() - startime; |
|||
startime = millis(); |
|||
windSpeed = 2500.0/anemometerDuration; |
|||
} |
|||
|
|||
anemometerState = anemometerVal; |
|||
|
|||
if(millis() >= timer) { |
|||
|
|||
Serial.println("--------------------------"); |
|||
timer = millis() + timerLimit; |
|||
|
|||
if(digitalRead(northPin)) {windDirection = windDirection + "N";} |
|||
if(digitalRead(southPin)) {windDirection = windDirection + "S";} |
|||
if(digitalRead(eastPin)) {windDirection = windDirection + "E";} |
|||
if(digitalRead(westPin)) {windDirection = windDirection + "W";} |
|||
|
|||
if(printSensorsData) { |
|||
Serial.print("Wind speed:\t"); |
|||
Serial.print(windSpeed); |
|||
Serial.println("Km/h"); |
|||
|
|||
Serial.print("Wind direction:\t"); |
|||
Serial.println(windDirection); |
|||
|
|||
} |
|||
//sendRequest();
|
|||
} |
|||
} |
@ -0,0 +1,35 @@ |
|||
|
|||
void getWind() { |
|||
|
|||
int index = 0; |
|||
|
|||
digitalWrite(ENABLE_PIN1, HIGH); |
|||
digitalWrite(ENABLE_PIN2, LOW); |
|||
delay(10); |
|||
if(sensor.write(codes, sizeof(codes)) == 8) { |
|||
digitalWrite(ENABLE_PIN1, LOW); |
|||
for (byte i = 0; i < 11; i++) { |
|||
values[index][i] = sensor.read(); |
|||
} |
|||
} |
|||
windSpeed = values[index][4]; |
|||
|
|||
delay(500); |
|||
|
|||
index = 1; |
|||
|
|||
digitalWrite(ENABLE_PIN1, LOW); |
|||
digitalWrite(ENABLE_PIN2, HIGH); |
|||
delay(10); |
|||
if(sensor.write(codes, sizeof(codes)) == 8) { |
|||
digitalWrite(ENABLE_PIN2, LOW); |
|||
for (byte i = 0; i < 11; i++) { |
|||
values[index][i] = sensor.read(); |
|||
} |
|||
} |
|||
windDirection = values[index][4]; |
|||
|
|||
digitalWrite(ENABLE_PIN1, LOW); |
|||
digitalWrite(ENABLE_PIN2, LOW); |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
|
|||
void sendData() { |
|||
|
|||
if((WiFiMulti.run() == WL_CONNECTED)) { |
|||
|
|||
WiFiClient client; |
|||
HTTPClient http; |
|||
|
|||
char apiString[100] = ""; |
|||
sprintf_P(apiString, server, windDirection, windSpeed, temperature, humidity, pressure); |
|||
|
|||
Serial.print("[HTTP] begin...\n"); |
|||
if (http.begin(client, apiString)) { |
|||
Serial.print("[HTTP] GET...\n"); |
|||
int httpCode = http.GET(); |
|||
if (httpCode > 0) { |
|||
Serial.printf("[HTTP] GET... code: %d\n", httpCode); |
|||
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) { |
|||
String payload = http.getString(); |
|||
Serial.println(payload); |
|||
} |
|||
} else { |
|||
Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str()); |
|||
} |
|||
http.end(); |
|||
} else { |
|||
Serial.printf("[HTTP} Unable to connect\n"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,82 @@ |
|||
|
|||
#include <SoftwareSerial.h> |
|||
#include <Wire.h> |
|||
#include <BME280I2C.h> |
|||
|
|||
#include <ESP8266WiFi.h> |
|||
#include <ESP8266WiFiMulti.h> |
|||
#include <ESP8266HTTPClient.h> |
|||
#include <WiFiClient.h> |
|||
|
|||
#define ENABLE_PIN1 D5 // 8 // dir
|
|||
#define ENABLE_PIN2 D6 // 9 // speed
|
|||
#define SERIAL_RO D7 // 10
|
|||
#define SERIAL_DI D8 // 11
|
|||
|
|||
#define WIFIUSR "NETGEAR41" |
|||
#define WIFIPWD "magicalbanana0" |
|||
|
|||
ESP8266WiFiMulti WiFiMulti; |
|||
BME280I2C bme; |
|||
|
|||
const byte codes[] = {0x01 ,0x03 ,0x00 ,0x00 ,0x00 ,0x02 ,0xC4 ,0x0B}; |
|||
const char server[] PROGMEM = "http://2.233.91.82/weather/api/station?data=%d|%d|%f|%f|%f"; |
|||
|
|||
byte values[2][20]; |
|||
SoftwareSerial sensor(SERIAL_RO, SERIAL_DI); |
|||
|
|||
int windSpeed = 0; |
|||
int windDirection = 0; |
|||
|
|||
float temperature = 0; |
|||
float humidity = 0; |
|||
float pressure = 0; |
|||
|
|||
void setup() { |
|||
// Initialize Serial Monitor for debugging
|
|||
Serial.begin(9600); |
|||
while(!Serial); |
|||
|
|||
// Initialize a Wire
|
|||
Wire.begin(); |
|||
while(!bme.begin()){ |
|||
Serial.println("Could not find BME280 sensor!"); |
|||
delay(1000); |
|||
} |
|||
|
|||
// Initialize a SoftwareSerial
|
|||
sensor.begin(4800); |
|||
delay(500); |
|||
pinMode(ENABLE_PIN1, OUTPUT); |
|||
pinMode(ENABLE_PIN2, OUTPUT); |
|||
|
|||
// Initialize WiFi
|
|||
for (uint8_t t = 4; t > 0; t--) { |
|||
Serial.printf("[SETUP] WAIT %d...\n", t); |
|||
Serial.flush(); |
|||
delay(1000); |
|||
} |
|||
|
|||
WiFi.mode(WIFI_STA); |
|||
WiFiMulti.addAP(WIFIUSR, WIFIPWD); |
|||
} |
|||
|
|||
void loop() { |
|||
|
|||
getWind(); |
|||
Serial.print("Direction: "); |
|||
Serial.println(windDirection); |
|||
Serial.print("Speed: "); |
|||
Serial.println(windSpeed); |
|||
|
|||
getBME280Data(); |
|||
Serial.print("Temp: "); |
|||
Serial.println(temperature); |
|||
Serial.print("Hum: "); |
|||
Serial.println(humidity); |
|||
Serial.print("Pres: "); |
|||
Serial.println(pressure); |
|||
|
|||
sendData(); |
|||
delay(10000); |
|||
} |
@ -0,0 +1,20 @@ |
|||
|
|||
void setupBME280() { |
|||
Wire.begin(); |
|||
|
|||
while(!bme.begin()) { |
|||
Serial.println("Could not find BME280 sensor!"); |
|||
delay(1000); |
|||
} |
|||
|
|||
switch(bme.chipModel()) { |
|||
case BME280::ChipModel_BME280: |
|||
Serial.println("Found BME280 sensor! Success."); |
|||
break; |
|||
case BME280::ChipModel_BMP280: |
|||
Serial.println("Found BMP280 sensor! No Humidity available."); |
|||
break; |
|||
default: |
|||
Serial.println("Found UNKNOWN sensor! Error!"); |
|||
} |
|||
} |
@ -0,0 +1,14 @@ |
|||
void getBME280Data() { |
|||
|
|||
float temp(NAN), hum(NAN), pres(NAN); |
|||
|
|||
BME280::TempUnit tempUnit(BME280::TempUnit_Celsius); |
|||
BME280::PresUnit presUnit(BME280::PresUnit_Pa); |
|||
|
|||
bme.read(pres, temp, hum, tempUnit, presUnit); |
|||
|
|||
temperature = temp; |
|||
humidity = hum; |
|||
pressure = pres; |
|||
|
|||
} |
@ -0,0 +1,7 @@ |
|||
|
|||
void getWind() { |
|||
|
|||
windDirection = 0; |
|||
windSpeed = 0; |
|||
|
|||
} |
@ -0,0 +1,26 @@ |
|||
G04 MADE WITH FRITZING* |
|||
G04 WWW.FRITZING.ORG* |
|||
G04 DOUBLE SIDED* |
|||
G04 HOLES PLATED* |
|||
G04 CONTOUR ON CENTER OF CONTOUR VECTOR* |
|||
%ASAXBY*% |
|||
%FSLAX23Y23*% |
|||
%MOIN*% |
|||
%OFA0B0*% |
|||
%SFA1.0B1.0*% |
|||
%ADD10R,3.333330X2.222220*% |
|||
%ADD11C,0.008000*% |
|||
%ADD10C,0.008*% |
|||
%LNCONTOUR*% |
|||
G90* |
|||
G70* |
|||
G54D10* |
|||
G54D11* |
|||
X4Y2218D02* |
|||
X3329Y2218D01* |
|||
X3329Y4D01* |
|||
X4Y4D01* |
|||
X4Y2218D01* |
|||
D02* |
|||
G04 End of contour* |
|||
M02* |
@ -0,0 +1,390 @@ |
|||
G04 MADE WITH FRITZING* |
|||
G04 WWW.FRITZING.ORG* |
|||
G04 DOUBLE SIDED* |
|||
G04 HOLES PLATED* |
|||
G04 CONTOUR ON CENTER OF CONTOUR VECTOR* |
|||
%ASAXBY*% |
|||
%FSLAX23Y23*% |
|||
%MOIN*% |
|||
%OFA0B0*% |
|||
%SFA1.0B1.0*% |
|||
%ADD10C,0.080000*% |
|||
%ADD11C,0.065278*% |
|||
%ADD12C,0.078000*% |
|||
%ADD13C,0.075000*% |
|||
%ADD14R,0.080000X0.080000*% |
|||
%ADD15R,0.075000X0.075000*% |
|||
%ADD16C,0.090000*% |
|||
%ADD17C,0.048000*% |
|||
%ADD18C,0.070000*% |
|||
%LNCOPPER0*% |
|||
G90* |
|||
G70* |
|||
G54D10* |
|||
X287Y2006D03* |
|||
X287Y1806D03* |
|||
X287Y1606D03* |
|||
X287Y1406D03* |
|||
X287Y1206D03* |
|||
X287Y1006D03* |
|||
X287Y806D03* |
|||
X287Y606D03* |
|||
X287Y406D03* |
|||
X287Y206D03* |
|||
X3043Y914D03* |
|||
X3043Y1114D03* |
|||
X3043Y1314D03* |
|||
X3043Y714D03* |
|||
G54D11* |
|||
X2628Y152D03* |
|||
X2728Y152D03* |
|||
X2828Y152D03* |
|||
X2928Y152D03* |
|||
X3028Y152D03* |
|||
X2168Y2052D03* |
|||
X2068Y2052D03* |
|||
X1968Y2052D03* |
|||
X1868Y2052D03* |
|||
X1768Y2052D03* |
|||
X1668Y2052D03* |
|||
X1568Y2052D03* |
|||
X1468Y2052D03* |
|||
X1368Y2052D03* |
|||
X1268Y2052D03* |
|||
X3028Y2052D03* |
|||
X2928Y2052D03* |
|||
X2828Y2052D03* |
|||
X2728Y2052D03* |
|||
X2628Y2052D03* |
|||
X2528Y2052D03* |
|||
X2428Y2052D03* |
|||
X2328Y2052D03* |
|||
X1728Y152D03* |
|||
X1628Y152D03* |
|||
X1828Y152D03* |
|||
X1928Y152D03* |
|||
X2028Y152D03* |
|||
X2128Y152D03* |
|||
X2228Y152D03* |
|||
X2328Y152D03* |
|||
X2528Y152D03* |
|||
G54D12* |
|||
X926Y1757D03* |
|||
X926Y1657D03* |
|||
X926Y1557D03* |
|||
X926Y1457D03* |
|||
X951Y772D03* |
|||
X951Y672D03* |
|||
X951Y572D03* |
|||
X951Y472D03* |
|||
X2550Y772D03* |
|||
X2550Y672D03* |
|||
X2550Y572D03* |
|||
X2550Y472D03* |
|||
X2525Y1757D03* |
|||
X2525Y1657D03* |
|||
X2525Y1557D03* |
|||
X2525Y1457D03* |
|||
X1271Y625D03* |
|||
X1271Y280D03* |
|||
X1566Y1707D03* |
|||
X1566Y1412D03* |
|||
X2403Y871D03* |
|||
X2304Y428D03* |
|||
X2403Y1363D03* |
|||
X730Y428D03* |
|||
X730Y821D03* |
|||
X730Y1412D03* |
|||
X730Y1806D03* |
|||
X1123Y625D03* |
|||
X1714Y1560D03* |
|||
X2206Y1363D03* |
|||
X2304Y1363D03* |
|||
G54D13* |
|||
X1566Y964D03* |
|||
X1566Y1264D03* |
|||
X1666Y964D03* |
|||
X1666Y1264D03* |
|||
X1766Y964D03* |
|||
X1766Y1264D03* |
|||
X1866Y964D03* |
|||
X1866Y1264D03* |
|||
X1966Y964D03* |
|||
X1966Y1264D03* |
|||
G54D14* |
|||
X287Y2006D03* |
|||
X3043Y714D03* |
|||
G54D15* |
|||
X1566Y964D03* |
|||
G54D10* |
|||
X2846Y329D02* |
|||
X2910Y190D01* |
|||
D02* |
|||
X2846Y1312D02* |
|||
X2846Y329D01* |
|||
D02* |
|||
X3000Y1313D02* |
|||
X2846Y1312D01* |
|||
D02* |
|||
X335Y674D02* |
|||
X910Y672D01* |
|||
D02* |
|||
X311Y640D02* |
|||
X335Y674D01* |
|||
G54D16* |
|||
D02* |
|||
X2206Y279D02* |
|||
X1862Y624D01* |
|||
D02* |
|||
X1322Y626D02* |
|||
X1320Y773D01* |
|||
D02* |
|||
X1862Y624D02* |
|||
X1322Y626D01* |
|||
D02* |
|||
X2206Y182D02* |
|||
X2206Y279D01* |
|||
D02* |
|||
X1322Y1462D02* |
|||
X1074Y1759D01* |
|||
D02* |
|||
X2203Y186D02* |
|||
X2206Y182D01* |
|||
D02* |
|||
X1320Y773D02* |
|||
X1322Y1462D01* |
|||
D02* |
|||
X1074Y1759D02* |
|||
X968Y1757D01* |
|||
D02* |
|||
X1320Y773D02* |
|||
X993Y772D01* |
|||
G54D17* |
|||
D02* |
|||
X1366Y535D02* |
|||
X1271Y478D01* |
|||
D02* |
|||
X1271Y478D02* |
|||
X1122Y478D01* |
|||
D02* |
|||
X1766Y527D02* |
|||
X1366Y535D01* |
|||
D02* |
|||
X2009Y182D02* |
|||
X2010Y279D01* |
|||
D02* |
|||
X1024Y478D02* |
|||
X993Y476D01* |
|||
D02* |
|||
X1122Y478D02* |
|||
X1024Y478D01* |
|||
D02* |
|||
X2010Y279D02* |
|||
X1766Y527D01* |
|||
D02* |
|||
X2005Y188D02* |
|||
X2009Y182D01* |
|||
D02* |
|||
X1122Y478D02* |
|||
X1123Y583D01* |
|||
G54D18* |
|||
D02* |
|||
X910Y573D02* |
|||
X729Y577D01* |
|||
D02* |
|||
X729Y577D02* |
|||
X729Y469D01* |
|||
G54D16* |
|||
D02* |
|||
X335Y823D02* |
|||
X326Y820D01* |
|||
D02* |
|||
X688Y822D02* |
|||
X335Y823D01* |
|||
G54D10* |
|||
D02* |
|||
X688Y1411D02* |
|||
X329Y1406D01* |
|||
G54D18* |
|||
D02* |
|||
X731Y1657D02* |
|||
X730Y1765D01* |
|||
D02* |
|||
X885Y1657D02* |
|||
X731Y1657D01* |
|||
G54D10* |
|||
D02* |
|||
X336Y1560D02* |
|||
X318Y1577D01* |
|||
D02* |
|||
X885Y1557D02* |
|||
X336Y1560D01* |
|||
G54D16* |
|||
D02* |
|||
X975Y1068D02* |
|||
X778Y1214D01* |
|||
D02* |
|||
X975Y822D02* |
|||
X975Y1068D01* |
|||
D02* |
|||
X969Y810D02* |
|||
X975Y822D01* |
|||
D02* |
|||
X778Y1214D02* |
|||
X329Y1206D01* |
|||
G54D17* |
|||
D02* |
|||
X2525Y1598D02* |
|||
X2525Y1615D01* |
|||
D02* |
|||
X2550Y614D02* |
|||
X2550Y631D01* |
|||
D02* |
|||
X1959Y722D02* |
|||
X2108Y577D01* |
|||
D02* |
|||
X1663Y723D02* |
|||
X1959Y722D01* |
|||
D02* |
|||
X2403Y577D02* |
|||
X2517Y496D01* |
|||
D02* |
|||
X2108Y577D02* |
|||
X2403Y577D01* |
|||
D02* |
|||
X1666Y925D02* |
|||
X1663Y723D01* |
|||
D02* |
|||
X2305Y1659D02* |
|||
X2305Y1904D01* |
|||
D02* |
|||
X2305Y1904D02* |
|||
X2197Y2021D01* |
|||
D02* |
|||
X2304Y1404D02* |
|||
X2305Y1659D01* |
|||
D02* |
|||
X1961Y1167D02* |
|||
X1664Y1165D01* |
|||
D02* |
|||
X1960Y1117D02* |
|||
X1961Y1167D01* |
|||
D02* |
|||
X1664Y1165D02* |
|||
X1665Y1225D01* |
|||
D02* |
|||
X2550Y1116D02* |
|||
X1960Y1117D01* |
|||
D02* |
|||
X2550Y814D02* |
|||
X2550Y1116D01* |
|||
D02* |
|||
X2206Y1904D02* |
|||
X2206Y1659D01* |
|||
D02* |
|||
X2206Y1659D02* |
|||
X2206Y1404D01* |
|||
D02* |
|||
X2097Y2021D02* |
|||
X2206Y1904D01* |
|||
D02* |
|||
X1862Y1067D02* |
|||
X1864Y1004D01* |
|||
D02* |
|||
X1469Y1560D02* |
|||
X1469Y1067D01* |
|||
D02* |
|||
X1469Y1067D02* |
|||
X1862Y1067D01* |
|||
D02* |
|||
X1673Y1560D02* |
|||
X1469Y1560D01* |
|||
D02* |
|||
X2402Y1019D02* |
|||
X1960Y1019D01* |
|||
D02* |
|||
X1960Y1019D02* |
|||
X1962Y1004D01* |
|||
D02* |
|||
X2403Y912D02* |
|||
X2402Y1019D01* |
|||
D02* |
|||
X2353Y2018D02* |
|||
X2402Y1953D01* |
|||
D02* |
|||
X2402Y1659D02* |
|||
X2403Y1404D01* |
|||
D02* |
|||
X2402Y1953D02* |
|||
X2402Y1659D01* |
|||
D02* |
|||
X2402Y1659D02* |
|||
X2484Y1657D01* |
|||
D02* |
|||
X2107Y1708D02* |
|||
X2107Y1904D01* |
|||
D02* |
|||
X2107Y1904D02* |
|||
X1997Y2021D01* |
|||
D02* |
|||
X1607Y1707D02* |
|||
X2107Y1708D01* |
|||
D02* |
|||
X1764Y1413D02* |
|||
X1607Y1412D01* |
|||
D02* |
|||
X1766Y1304D02* |
|||
X1764Y1413D01* |
|||
D02* |
|||
X1960Y1461D02* |
|||
X1862Y1461D01* |
|||
D02* |
|||
X2157Y1216D02* |
|||
X1960Y1461D01* |
|||
D02* |
|||
X1862Y1461D02* |
|||
X1865Y1304D01* |
|||
D02* |
|||
X2699Y1756D02* |
|||
X2699Y1213D01* |
|||
D02* |
|||
X2699Y1213D02* |
|||
X2157Y1216D01* |
|||
D02* |
|||
X2567Y1756D02* |
|||
X2699Y1756D01* |
|||
G54D16* |
|||
D02* |
|||
X928Y2002D02* |
|||
X336Y2003D01* |
|||
D02* |
|||
X927Y1798D02* |
|||
X928Y2002D01* |
|||
D02* |
|||
X1322Y626D02* |
|||
X1312Y625D01* |
|||
D02* |
|||
X532Y282D02* |
|||
X1207Y280D01* |
|||
D02* |
|||
X532Y428D02* |
|||
X532Y282D01* |
|||
D02* |
|||
X335Y428D02* |
|||
X532Y428D01* |
|||
D02* |
|||
X325Y424D02* |
|||
X335Y428D01* |
|||
G54D17* |
|||
D02* |
|||
X2304Y182D02* |
|||
X2304Y387D01* |
|||
D02* |
|||
X2302Y185D02* |
|||
X2304Y182D01* |
|||
G54D16* |
|||
D02* |
|||
X336Y2003D02* |
|||
X329Y2004D01* |
|||
G04 End of Copper0* |
|||
M02* |
@ -0,0 +1,273 @@ |
|||
G04 MADE WITH FRITZING* |
|||
G04 WWW.FRITZING.ORG* |
|||
G04 DOUBLE SIDED* |
|||
G04 HOLES PLATED* |
|||
G04 CONTOUR ON CENTER OF CONTOUR VECTOR* |
|||
%ASAXBY*% |
|||
%FSLAX23Y23*% |
|||
%MOIN*% |
|||
%OFA0B0*% |
|||
%SFA1.0B1.0*% |
|||
%ADD10C,0.080000*% |
|||
%ADD11C,0.065278*% |
|||
%ADD12C,0.078000*% |
|||
%ADD13C,0.075000*% |
|||
%ADD14R,0.080000X0.080000*% |
|||
%ADD15R,0.075000X0.075000*% |
|||
%ADD16C,0.070000*% |
|||
%ADD17C,0.090000*% |
|||
%ADD18C,0.048000*% |
|||
%LNCOPPER1*% |
|||
G90* |
|||
G70* |
|||
G54D10* |
|||
X287Y2006D03* |
|||
X287Y1806D03* |
|||
X287Y1606D03* |
|||
X287Y1406D03* |
|||
X287Y1206D03* |
|||
X287Y1006D03* |
|||
X287Y806D03* |
|||
X287Y606D03* |
|||
X287Y406D03* |
|||
X287Y206D03* |
|||
X3043Y914D03* |
|||
X3043Y1114D03* |
|||
X3043Y1314D03* |
|||
X3043Y714D03* |
|||
G54D11* |
|||
X2628Y152D03* |
|||
X2728Y152D03* |
|||
X2828Y152D03* |
|||
X2928Y152D03* |
|||
X3028Y152D03* |
|||
X2168Y2052D03* |
|||
X2068Y2052D03* |
|||
X1968Y2052D03* |
|||
X1868Y2052D03* |
|||
X1768Y2052D03* |
|||
X1668Y2052D03* |
|||
X1568Y2052D03* |
|||
X1468Y2052D03* |
|||
X1368Y2052D03* |
|||
X1268Y2052D03* |
|||
X3028Y2052D03* |
|||
X2928Y2052D03* |
|||
X2828Y2052D03* |
|||
X2728Y2052D03* |
|||
X2628Y2052D03* |
|||
X2528Y2052D03* |
|||
X2428Y2052D03* |
|||
X2328Y2052D03* |
|||
X1728Y152D03* |
|||
X1628Y152D03* |
|||
X1828Y152D03* |
|||
X1928Y152D03* |
|||
X2028Y152D03* |
|||
X2128Y152D03* |
|||
X2228Y152D03* |
|||
X2328Y152D03* |
|||
X2528Y152D03* |
|||
G54D12* |
|||
X926Y1757D03* |
|||
X926Y1657D03* |
|||
X926Y1557D03* |
|||
X926Y1457D03* |
|||
X951Y772D03* |
|||
X951Y672D03* |
|||
X951Y572D03* |
|||
X951Y472D03* |
|||
X2550Y772D03* |
|||
X2550Y672D03* |
|||
X2550Y572D03* |
|||
X2550Y472D03* |
|||
X2525Y1757D03* |
|||
X2525Y1657D03* |
|||
X2525Y1557D03* |
|||
X2525Y1457D03* |
|||
X1271Y625D03* |
|||
X1271Y280D03* |
|||
X1566Y1707D03* |
|||
X1566Y1412D03* |
|||
X2403Y871D03* |
|||
X2304Y428D03* |
|||
X2403Y1363D03* |
|||
X730Y428D03* |
|||
X730Y821D03* |
|||
X730Y1412D03* |
|||
X730Y1806D03* |
|||
X1123Y625D03* |
|||
X1714Y1560D03* |
|||
X2206Y1363D03* |
|||
X2304Y1363D03* |
|||
G54D13* |
|||
X1566Y964D03* |
|||
X1566Y1264D03* |
|||
X1666Y964D03* |
|||
X1666Y1264D03* |
|||
X1766Y964D03* |
|||
X1766Y1264D03* |
|||
X1866Y964D03* |
|||
X1866Y1264D03* |
|||
X1966Y964D03* |
|||
X1966Y1264D03* |
|||
G54D14* |
|||
X287Y2006D03* |
|||
X3043Y714D03* |
|||
G54D15* |
|||
X1566Y964D03* |
|||
G54D16* |
|||
X1911Y181D02* |
|||
X1907Y189D01* |
|||
G54D10* |
|||
D02* |
|||
X2796Y920D02* |
|||
X3000Y915D01* |
|||
D02* |
|||
X2796Y1902D02* |
|||
X2796Y920D01* |
|||
D02* |
|||
X1565Y1904D02* |
|||
X2796Y1902D01* |
|||
D02* |
|||
X1567Y2009D02* |
|||
X1565Y1904D01* |
|||
G54D16* |
|||
D02* |
|||
X2699Y722D02* |
|||
X2699Y327D01* |
|||
D02* |
|||
X2404Y279D02* |
|||
X1911Y279D01* |
|||
D02* |
|||
X1911Y279D02* |
|||
X1911Y181D01* |
|||
D02* |
|||
X2451Y327D02* |
|||
X2404Y279D01* |
|||
D02* |
|||
X2699Y327D02* |
|||
X2451Y327D01* |
|||
D02* |
|||
X3000Y715D02* |
|||
X2699Y722D01* |
|||
G54D10* |
|||
D02* |
|||
X3190Y1118D02* |
|||
X3085Y1115D01* |
|||
D02* |
|||
X3190Y327D02* |
|||
X3190Y1118D01* |
|||
D02* |
|||
X3057Y183D02* |
|||
X3190Y327D01* |
|||
G54D17* |
|||
D02* |
|||
X1416Y135D02* |
|||
X1418Y428D01* |
|||
D02* |
|||
X1418Y428D02* |
|||
X2241Y428D01* |
|||
D02* |
|||
X580Y135D02* |
|||
X1416Y135D01* |
|||
D02* |
|||
X485Y183D02* |
|||
X580Y135D01* |
|||
D02* |
|||
X335Y183D02* |
|||
X330Y185D01* |
|||
D02* |
|||
X485Y183D02* |
|||
X335Y183D01* |
|||
D02* |
|||
X485Y1020D02* |
|||
X485Y183D01* |
|||
D02* |
|||
X485Y1020D02* |
|||
X483Y1806D01* |
|||
D02* |
|||
X483Y1806D02* |
|||
X334Y1806D01* |
|||
D02* |
|||
X335Y1020D02* |
|||
X485Y1020D01* |
|||
D02* |
|||
X332Y1020D02* |
|||
X335Y1020D01* |
|||
G54D18* |
|||
D02* |
|||
X1762Y820D02* |
|||
X2206Y820D01* |
|||
D02* |
|||
X2206Y820D02* |
|||
X2206Y1322D01* |
|||
D02* |
|||
X1765Y925D02* |
|||
X1762Y820D01* |
|||
D02* |
|||
X2303Y674D02* |
|||
X2304Y1322D01* |
|||
D02* |
|||
X2303Y674D02* |
|||
X1518Y674D01* |
|||
D02* |
|||
X1518Y921D02* |
|||
X1537Y938D01* |
|||
D02* |
|||
X1518Y674D02* |
|||
X1518Y921D01* |
|||
D02* |
|||
X2509Y673D02* |
|||
X2303Y674D01* |
|||
G54D16* |
|||
D02* |
|||
X1123Y1216D02* |
|||
X1123Y666D01* |
|||
D02* |
|||
X952Y1425D02* |
|||
X1123Y1216D01* |
|||
G54D18* |
|||
D02* |
|||
X2352Y1559D02* |
|||
X1755Y1560D01* |
|||
D02* |
|||
X2490Y1478D02* |
|||
X2352Y1559D01* |
|||
G54D16* |
|||
D02* |
|||
X730Y469D02* |
|||
X730Y780D01* |
|||
D02* |
|||
X730Y1453D02* |
|||
X730Y1765D01* |
|||
G54D18* |
|||
D02* |
|||
X1271Y321D02* |
|||
X1271Y583D01* |
|||
D02* |
|||
X1566Y1453D02* |
|||
X1566Y1666D01* |
|||
D02* |
|||
X2403Y912D02* |
|||
X2403Y1322D01* |
|||
D02* |
|||
X1567Y1116D02* |
|||
X1960Y1116D01* |
|||
D02* |
|||
X1960Y1116D02* |
|||
X1965Y1004D01* |
|||
D02* |
|||
X1566Y1225D02* |
|||
X1567Y1116D01* |
|||
D02* |
|||
X2304Y1461D02* |
|||
X1960Y1461D01* |
|||
D02* |
|||
X1960Y1461D02* |
|||
X1965Y1293D01* |
|||
D02* |
|||
X2304Y1393D02* |
|||
X2304Y1461D01* |
|||
G04 End of Copper1* |
|||
M02* |
@ -0,0 +1,102 @@ |
|||
; NON-PLATED HOLES START AT T1 |
|||
; THROUGH (PLATED) HOLES START AT T100 |
|||
M48 |
|||
INCH |
|||
T100C0.040000 |
|||
T101C0.038000 |
|||
T102C0.035000 |
|||
T103C0.040278 |
|||
% |
|||
T100 |
|||
X002866Y004057 |
|||
X002866Y016057 |
|||
X030425Y011136 |
|||
X002866Y020057 |
|||
X002866Y008057 |
|||
X002866Y006057 |
|||
X002866Y014057 |
|||
X030425Y009136 |
|||
X002866Y010057 |
|||
X030425Y007136 |
|||
X002866Y018057 |
|||
X002866Y002057 |
|||
X030425Y013136 |
|||
X002866Y012057 |
|||
T101 |
|||
X007295Y014120 |
|||
X025504Y004722 |
|||
X025253Y015565 |
|||
X025253Y016565 |
|||
X025504Y006722 |
|||
X025504Y005722 |
|||
X023043Y004277 |
|||
X009514Y007722 |
|||
X022059Y013628 |
|||
X012708Y002801 |
|||
X023043Y013628 |
|||
X025253Y017565 |
|||
X025504Y007722 |
|||
X009514Y006722 |
|||
X011232Y006246 |
|||
X025253Y014565 |
|||
X009263Y017565 |
|||
X009263Y016565 |
|||
X009263Y014565 |
|||
X009263Y015565 |
|||
X012708Y006246 |
|||
X017137Y015596 |
|||
X007295Y018057 |
|||
X007295Y008214 |
|||
X015661Y014120 |
|||
X024027Y013628 |
|||
X009514Y005722 |
|||
X007295Y004277 |
|||
X024027Y008707 |
|||
X009514Y004722 |
|||
X015661Y017073 |
|||
T102 |
|||
X019661Y009644 |
|||
X016661Y009644 |
|||
X015661Y012644 |
|||
X017661Y009644 |
|||
X019661Y012644 |
|||
X018661Y012644 |
|||
X017661Y012644 |
|||
X015661Y009644 |
|||
X018661Y009644 |
|||
X016661Y012644 |
|||
T103 |
|||
X016677Y020518 |
|||
X023277Y001518 |
|||
X016277Y001518 |
|||
X024277Y020518 |
|||
X013677Y020518 |
|||
X021277Y001518 |
|||
X030277Y001518 |
|||
X029277Y001518 |
|||
X029277Y020518 |
|||
X023277Y020518 |
|||
X015677Y020518 |
|||
X025277Y020518 |
|||
X014677Y020518 |
|||
X020277Y001518 |
|||
X012677Y020518 |
|||
X017277Y001518 |
|||
X030277Y020518 |
|||
X018277Y001518 |
|||
X028277Y001518 |
|||
X022277Y001518 |
|||
X026277Y001518 |
|||
X019277Y001518 |
|||
X026277Y020518 |
|||
X021677Y020518 |
|||
X017677Y020518 |
|||
X027277Y020518 |
|||
X028277Y020518 |
|||
X019677Y020518 |
|||
X027277Y001518 |
|||
X025277Y001518 |
|||
X020677Y020518 |
|||
X018677Y020518 |
|||
T00 |
|||
M30 |
@ -0,0 +1,117 @@ |
|||
G04 MADE WITH FRITZING* |
|||
G04 WWW.FRITZING.ORG* |
|||
G04 DOUBLE SIDED* |
|||
G04 HOLES PLATED* |
|||
G04 CONTOUR ON CENTER OF CONTOUR VECTOR* |
|||
%ASAXBY*% |
|||
%FSLAX23Y23*% |
|||
%MOIN*% |
|||
%OFA0B0*% |
|||
%SFA1.0B1.0*% |
|||
%ADD10C,0.090000*% |
|||
%ADD11C,0.075278*% |
|||
%ADD12C,0.088000*% |
|||
%ADD13C,0.085000*% |
|||
%ADD14R,0.090000X0.090000*% |
|||
%ADD15R,0.085000X0.085000*% |
|||
%LNMASK0*% |
|||
G90* |
|||
G70* |
|||
G54D10* |
|||
X287Y2006D03* |
|||
X287Y1806D03* |
|||
X287Y1606D03* |
|||
X287Y1406D03* |
|||
X287Y1206D03* |
|||
X287Y1006D03* |
|||
X287Y806D03* |
|||
X287Y606D03* |
|||
X287Y406D03* |
|||
X287Y206D03* |
|||
X3043Y914D03* |
|||
X3043Y1114D03* |
|||
X3043Y1314D03* |
|||
X3043Y714D03* |
|||
G54D11* |
|||
X2628Y152D03* |
|||
X2728Y152D03* |
|||
X2828Y152D03* |
|||
X2928Y152D03* |
|||
X3028Y152D03* |
|||
X2168Y2052D03* |
|||
X2068Y2052D03* |
|||
X1968Y2052D03* |
|||
X1868Y2052D03* |
|||
X1768Y2052D03* |
|||
X1668Y2052D03* |
|||
X1568Y2052D03* |
|||
X1468Y2052D03* |
|||
X1368Y2052D03* |
|||
X1268Y2052D03* |
|||
X3028Y2052D03* |
|||
X2928Y2052D03* |
|||
X2828Y2052D03* |
|||
X2728Y2052D03* |
|||
X2628Y2052D03* |
|||
X2528Y2052D03* |
|||
X2428Y2052D03* |
|||
X2328Y2052D03* |
|||
X1728Y152D03* |
|||
X1628Y152D03* |
|||
X1828Y152D03* |
|||
X1928Y152D03* |
|||
X2028Y152D03* |
|||
X2128Y152D03* |
|||
X2228Y152D03* |
|||
X2328Y152D03* |
|||
X2528Y152D03* |
|||
G54D12* |
|||
X926Y1757D03* |
|||
X926Y1657D03* |
|||
X926Y1557D03* |
|||
X926Y1457D03* |
|||
X951Y772D03* |
|||
X951Y672D03* |
|||
X951Y572D03* |
|||
X951Y472D03* |
|||
X2550Y772D03* |
|||
X2550Y672D03* |
|||
X2550Y572D03* |
|||
X2550Y472D03* |
|||
X2525Y1757D03* |
|||
X2525Y1657D03* |
|||
X2525Y1557D03* |
|||
X2525Y1457D03* |
|||
X1271Y625D03* |
|||
X1271Y280D03* |
|||
X1566Y1707D03* |
|||
X1566Y1412D03* |
|||
X2403Y871D03* |
|||
X2304Y428D03* |
|||
X2403Y1363D03* |
|||
X730Y428D03* |
|||
X730Y821D03* |
|||
X730Y1412D03* |
|||
X730Y1806D03* |
|||
X1123Y625D03* |
|||
X1714Y1560D03* |
|||
X2206Y1363D03* |
|||
X2304Y1363D03* |
|||
G54D13* |
|||
X1566Y964D03* |
|||
X1566Y1264D03* |
|||
X1666Y964D03* |
|||
X1666Y1264D03* |
|||
X1766Y964D03* |
|||
X1766Y1264D03* |
|||
X1866Y964D03* |
|||
X1866Y1264D03* |
|||
X1966Y964D03* |
|||
X1966Y1264D03* |
|||
G54D14* |
|||
X287Y2006D03* |
|||
X3043Y714D03* |
|||
G54D15* |
|||
X1566Y964D03* |
|||
G04 End of Mask0* |
|||
M02* |
@ -0,0 +1,117 @@ |
|||
G04 MADE WITH FRITZING* |
|||
G04 WWW.FRITZING.ORG* |
|||
G04 DOUBLE SIDED* |
|||
G04 HOLES PLATED* |
|||
G04 CONTOUR ON CENTER OF CONTOUR VECTOR* |
|||
%ASAXBY*% |
|||
%FSLAX23Y23*% |
|||
%MOIN*% |
|||
%OFA0B0*% |
|||
%SFA1.0B1.0*% |
|||
%ADD10C,0.090000*% |
|||
%ADD11C,0.075278*% |
|||
%ADD12C,0.088000*% |
|||
%ADD13C,0.085000*% |
|||
%ADD14R,0.090000X0.090000*% |
|||
%ADD15R,0.085000X0.085000*% |
|||
%LNMASK1*% |
|||
G90* |
|||
G70* |
|||
G54D10* |
|||
X287Y2006D03* |
|||
X287Y1806D03* |
|||
X287Y1606D03* |
|||
X287Y1406D03* |
|||
X287Y1206D03* |
|||
X287Y1006D03* |
|||
X287Y806D03* |
|||
X287Y606D03* |
|||
X287Y406D03* |
|||
X287Y206D03* |
|||
X3043Y914D03* |
|||
X3043Y1114D03* |
|||
X3043Y1314D03* |
|||
X3043Y714D03* |
|||
G54D11* |
|||
X2628Y152D03* |
|||
X2728Y152D03* |
|||
X2828Y152D03* |
|||
X2928Y152D03* |
|||
X3028Y152D03* |
|||
X2168Y2052D03* |
|||
X2068Y2052D03* |
|||
X1968Y2052D03* |
|||
X1868Y2052D03* |
|||
X1768Y2052D03* |
|||
X1668Y2052D03* |
|||
X1568Y2052D03* |
|||
X1468Y2052D03* |
|||
X1368Y2052D03* |
|||
X1268Y2052D03* |
|||
X3028Y2052D03* |
|||
X2928Y2052D03* |
|||
X2828Y2052D03* |
|||
X2728Y2052D03* |
|||
X2628Y2052D03* |
|||
X2528Y2052D03* |
|||
X2428Y2052D03* |
|||
X2328Y2052D03* |
|||
X1728Y152D03* |
|||
X1628Y152D03* |
|||
X1828Y152D03* |
|||
X1928Y152D03* |
|||
X2028Y152D03* |
|||
X2128Y152D03* |
|||
X2228Y152D03* |
|||
X2328Y152D03* |
|||
X2528Y152D03* |
|||
G54D12* |
|||
X926Y1757D03* |
|||
X926Y1657D03* |
|||
X926Y1557D03* |
|||
X926Y1457D03* |
|||
X951Y772D03* |
|||
X951Y672D03* |
|||
X951Y572D03* |
|||
X951Y472D03* |
|||
X2550Y772D03* |
|||
X2550Y672D03* |
|||
X2550Y572D03* |
|||
X2550Y472D03* |
|||
X2525Y1757D03* |
|||
X2525Y1657D03* |
|||
X2525Y1557D03* |
|||
X2525Y1457D03* |
|||
X1271Y625D03* |
|||
X1271Y280D03* |
|||
X1566Y1707D03* |
|||
X1566Y1412D03* |
|||
X2403Y871D03* |
|||
X2304Y428D03* |
|||
X2403Y1363D03* |
|||
X730Y428D03* |
|||
X730Y821D03* |
|||
X730Y1412D03* |
|||
X730Y1806D03* |
|||
X1123Y625D03* |
|||
X1714Y1560D03* |
|||
X2206Y1363D03* |
|||
X2304Y1363D03* |
|||
G54D13* |
|||
X1566Y964D03* |
|||
X1566Y1264D03* |
|||
X1666Y964D03* |
|||
X1666Y1264D03* |
|||
X1766Y964D03* |
|||
X1766Y1264D03* |
|||
X1866Y964D03* |
|||
X1866Y1264D03* |
|||
X1966Y964D03* |
|||
X1966Y1264D03* |
|||
G54D14* |
|||
X287Y2006D03* |
|||
X3043Y714D03* |
|||
G54D15* |
|||
X1566Y964D03* |
|||
G04 End of Mask1* |
|||
M02* |
@ -0,0 +1,43 @@ |
|||
*Pick And Place List |
|||
*Company= |
|||
*Author= |
|||
*eMail= |
|||
* |
|||
*Project=SensorsPCB |
|||
*Date=18:53:18 |
|||
*CreatedBy=Fritzing 0.9.3b.04.19.5c895d327c44a3114e5fcc9d8260daf0cbb52806 |
|||
* |
|||
* |
|||
*Coordinates in mm, always center of component |
|||
*Origin 0/0=Lower left corner of PCB |
|||
*Rotation in degree (0-360, math. pos.) |
|||
* |
|||
*No;Value;Package;X;Y;Rotation;Side;Name |
|||
1;;THT;61.0302;-22.1159;0;Bottom;J24 |
|||
2;;THT;18.5301;-45.8659;0;Bottom;J9 |
|||
3;;;70.3817;-25.6133;-90;Bottom;TXT1 |
|||
4;;DIP (Dual Inline) [THT];44.8603;-28.3059;-90;Bottom;IC3 |
|||
5;;THT;23.5302;-40.8059;0;Bottom;J2 |
|||
6;;THT;18.5301;-35.8659;0;Bottom;J10 |
|||
7;;;44.6644;-28.7548;90;Bottom;IMG1 |
|||
8;;;47.6632;-27.9859;0;Bottom;Componente1 |
|||
9;;;14.5511;-25.9789;90;Bottom;TXT1 |
|||
10;;THT;61.0302;-34.6159;0;Bottom;J23 |
|||
11;;THT;39.7803;-43.3659;0;Bottom;J26 |
|||
12;;THT;32.2803;-15.8658;0;Bottom;J29 |
|||
13;;THT;58.5303;-34.6159;0;Bottom;J17 |
|||
14;;THT;58.5303;-10.866;0;Bottom;J30 |
|||
15;;THT;64.1432;-40.8059;0;Bottom;J3 |
|||
16;;THT;24.1672;-15.806;0;Bottom;J4 |
|||
17;;THT;73.6503;-25.7459;180;Bottom;J39 |
|||
18;;THT;10.9103;-28.0859;0;Bottom;J40 |
|||
19;;THT;56.0301;-34.6159;0;Bottom;J20 |
|||
20;;THT;18.5301;-20.8659;0;Bottom;J11 |
|||
21;;THT;43.5302;-39.6159;0;Bottom;J21 |
|||
22;;THT;32.2803;-7.1159;0;Bottom;J28 |
|||
23;;THT;39.7803;-35.8659;0;Bottom;J25 |
|||
24;;;11.3806;-27.8831;90;Bottom;TXT1 |
|||
25;;THT;64.7801;-15.806;0;Bottom;J5 |
|||
26;;THT;28.5304;-15.8658;0;Bottom;J8 |
|||
27;;THT;18.5301;-10.866;0;Bottom;J12 |
|||
28;;;74.4035;-26.2564;-90;Bottom;TXT1 |
File diff suppressed because it is too large
File diff suppressed because it is too large
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 550 KiB |
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
Before Width: | Height: | Size: 528 KiB |
@ -0,0 +1,56 @@ |
|||
#include <SoftwareSerial.h> |
|||
#include <Wire.h> |
|||
|
|||
const int enable[] = {0,8,9}; |
|||
const byte codes[] = {0x01 ,0x03 ,0x00 ,0x00 ,0x00 ,0x02 ,0xC4 ,0x0B}; |
|||
|
|||
byte values[3][20]; |
|||
SoftwareSerial sensor(10, 11); // RO / DI
|
|||
|
|||
void setup() { |
|||
Serial.begin(4800); |
|||
while(!Serial){;} |
|||
sensor.begin(4800); |
|||
delay(500); |
|||
pinMode(enable[1], OUTPUT); |
|||
pinMode(enable[2], OUTPUT); |
|||
} |
|||
|
|||
void loop() { |
|||
int val1 = 0 ; // SPEED
|
|||
int val2 = 0 ; // DIR
|
|||
|
|||
|
|||
readSensor(1); |
|||
//val1 = ((values[1][5]*256)+values[1][6]);
|
|||
val1 = values[1][4]; |
|||
Serial.print("dir: "); |
|||
Serial.println(val1); |
|||
|
|||
delay(1000); |
|||
|
|||
readSensor(2); |
|||
val2 = values[2][4]; |
|||
Serial.print("speed: "); |
|||
Serial.println(val2); |
|||
|
|||
delay(1000); |
|||
|
|||
|
|||
} |
|||
|
|||
byte readSensor(int index) { |
|||
digitalWrite(enable[index], HIGH); |
|||
delay(10); |
|||
if(sensor.write(codes, sizeof(codes)) == 8) { |
|||
digitalWrite(enable[index], LOW); |
|||
for (byte i = 0; i < 11; i++) { |
|||
values[index][i] = sensor.read(); |
|||
Serial.print(values[index][i]); |
|||
Serial.print(" "); |
|||
} |
|||
} |
|||
Serial.println(" "); |
|||
} |
|||
|
|||
|
@ -0,0 +1,45 @@ |
|||
#include <SoftwareSerial.h> |
|||
#include <Wire.h> |
|||
#define RE 7 |
|||
#define DE 8 |
|||
|
|||
const byte O2[] = {0x01 ,0x03 ,0x00 ,0x00 ,0x00 ,0x02 ,0xC4 ,0x0B}; |
|||
|
|||
byte values[20]; |
|||
SoftwareSerial mod(10, 11); // RO / DI
|
|||
|
|||
void setup() { |
|||
Serial.begin(4800); |
|||
mod.begin(4800); |
|||
pinMode(RE, OUTPUT); |
|||
pinMode(DE, OUTPUT); |
|||
} |
|||
|
|||
void loop() { |
|||
int val1 = 0 ; |
|||
Calculate(); |
|||
val1 = ((values[5]*256)+values[8]); |
|||
Serial.print("v: "); |
|||
Serial.println(val1); |
|||
|
|||
delay(1000); |
|||
} |
|||
|
|||
|
|||
byte Calculate() { |
|||
digitalWrite(DE, HIGH); |
|||
digitalWrite(RE, HIGH); |
|||
delay(10); |
|||
if (mod.write(O2, sizeof(O2)) == 8) { |
|||
digitalWrite(DE, LOW); |
|||
digitalWrite(RE, LOW); |
|||
for (byte i = 0; i < 11; i++) { |
|||
//Serial.print(mod.read(),HEX);
|
|||
values[i] = mod.read(); |
|||
//Serial.print(values[i], HEX);
|
|||
//Serial.print(" ");
|
|||
} |
|||
Serial.println(); |
|||
} |
|||
return values[6]; |
|||
} |
@ -0,0 +1,46 @@ |
|||
#include <SoftwareSerial.h> |
|||
#include <Wire.h> |
|||
#define RE 7 |
|||
#define DE 8 |
|||
|
|||
const byte O2[] = {0x01 ,0x03 ,0x00 ,0x00 ,0x00 ,0x02 ,0xC4 ,0x0B}; |
|||
|
|||
byte values[20]; |
|||
SoftwareSerial mod(10, 11); // RO / DI
|
|||
|
|||
void setup() { |
|||
Serial.begin(4800); |
|||
mod.begin(4800); |
|||
pinMode(RE, OUTPUT); |
|||
pinMode(DE, OUTPUT); |
|||
} |
|||
|
|||
void loop() { |
|||
int val1 = 0 ; |
|||
Calculate(); |
|||
//val1 = ((values[5]*256)+values[8]);
|
|||
val1 = (values[4]); |
|||
Serial.print("v: "); |
|||
Serial.println(val1); |
|||
|
|||
|
|||
delay(1000); |
|||
} |
|||
|
|||
byte Calculate() { |
|||
digitalWrite(DE, HIGH); |
|||
digitalWrite(RE, HIGH); |
|||
delay(10); |
|||
if (mod.write(O2, sizeof(O2)) == 8) { |
|||
digitalWrite(DE, LOW); |
|||
digitalWrite(RE, LOW); |
|||
for (byte i = 0; i < 11; i++) { |
|||
//Serial.print(mod.read(),HEX);
|
|||
values[i] = mod.read(); |
|||
//Serial.print(values[i]);
|
|||
//Serial.print(" ");
|
|||
} |
|||
Serial.println(); |
|||
} |
|||
//return values[6];
|
|||
} |
@ -0,0 +1,3 @@ |
|||
MySQL |
|||
USR dslak |
|||
PWD D5l4kMyPwd! |
@ -0,0 +1 @@ |
|||
rsync -rlvz --delete --exclude "tmp" --exclude "config.php" -e "ssh -p2222" ./api/ dslak@2.233.91.82:/var/www/weather/api/ |
@ -0,0 +1,16 @@ |
|||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. |
|||
# For additional information regarding the format and rule options, please see: |
|||
# https://github.com/browserslist/browserslist#queries |
|||
|
|||
# For the full list of supported browsers by the Angular framework, please see: |
|||
# https://angular.io/guide/browser-support |
|||
|
|||
# You can see what browsers were selected by your queries by running: |
|||
# npx browserslist |
|||
|
|||
last 1 Chrome version |
|||
last 1 Firefox version |
|||
last 2 Edge major versions |
|||
last 2 Safari major versions |
|||
last 2 iOS major versions |
|||
Firefox ESR |
@ -0,0 +1,16 @@ |
|||
# Editor configuration, see https://editorconfig.org |
|||
root = true |
|||
|
|||
[*] |
|||
charset = utf-8 |
|||
indent_style = space |
|||
indent_size = 2 |
|||
insert_final_newline = true |
|||
trim_trailing_whitespace = true |
|||
|
|||
[*.ts] |
|||
quote_type = single |
|||
|
|||
[*.md] |
|||
max_line_length = off |
|||
trim_trailing_whitespace = false |
@ -0,0 +1,42 @@ |
|||
# See http://help.github.com/ignore-files/ for more about ignoring files. |
|||
|
|||
# Compiled output |
|||
/dist |
|||
/tmp |
|||
/out-tsc |
|||
/bazel-out |
|||
|
|||
# Node |
|||
/node_modules |
|||
npm-debug.log |
|||
yarn-error.log |
|||
|
|||
# IDEs and editors |
|||
.idea/ |
|||
.project |
|||
.classpath |
|||
.c9/ |
|||
*.launch |
|||
.settings/ |
|||
*.sublime-workspace |
|||
|
|||
# Visual Studio Code |
|||
.vscode/* |
|||
!.vscode/settings.json |
|||
!.vscode/tasks.json |
|||
!.vscode/launch.json |
|||
!.vscode/extensions.json |
|||
.history/* |
|||
|
|||
# Miscellaneous |
|||
/.angular/cache |
|||
.sass-cache/ |
|||
/connect.lock |
|||
/coverage |
|||
/libpeerconnection.log |
|||
testem.log |
|||
/typings |
|||
|
|||
# System files |
|||
.DS_Store |
|||
Thumbs.db |
@ -0,0 +1,4 @@ |
|||
{ |
|||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 |
|||
"recommendations": ["angular.ng-template"] |
|||
} |
@ -0,0 +1,20 @@ |
|||
{ |
|||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
|||
"version": "0.2.0", |
|||
"configurations": [ |
|||
{ |
|||
"name": "ng serve", |
|||
"type": "pwa-chrome", |
|||
"request": "launch", |
|||
"preLaunchTask": "npm: start", |
|||
"url": "http://localhost:4200/" |
|||
}, |
|||
{ |
|||
"name": "ng test", |
|||
"type": "chrome", |
|||
"request": "launch", |
|||
"preLaunchTask": "npm: test", |
|||
"url": "http://localhost:9876/debug.html" |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,42 @@ |
|||
{ |
|||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 |
|||
"version": "2.0.0", |
|||
"tasks": [ |
|||
{ |
|||
"type": "npm", |
|||
"script": "start", |
|||
"isBackground": true, |
|||
"problemMatcher": { |
|||
"owner": "typescript", |
|||
"pattern": "$tsc", |
|||
"background": { |
|||
"activeOnStart": true, |
|||
"beginsPattern": { |
|||
"regexp": "(.*?)" |
|||
}, |
|||
"endsPattern": { |
|||
"regexp": "bundle generation complete" |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
"type": "npm", |
|||
"script": "test", |
|||
"isBackground": true, |
|||
"problemMatcher": { |
|||
"owner": "typescript", |
|||
"pattern": "$tsc", |
|||
"background": { |
|||
"activeOnStart": true, |
|||
"beginsPattern": { |
|||
"regexp": "(.*?)" |
|||
}, |
|||
"endsPattern": { |
|||
"regexp": "bundle generation complete" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,27 @@ |
|||
# Weather |
|||
|
|||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.1. |
|||
|
|||
## Development server |
|||
|
|||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. |
|||
|
|||
## Code scaffolding |
|||
|
|||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. |
|||
|
|||
## Build |
|||
|
|||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. |
|||
|
|||
## Running unit tests |
|||
|
|||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). |
|||
|
|||
## Running end-to-end tests |
|||
|
|||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. |
|||
|
|||
## Further help |
|||
|
|||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. |
@ -0,0 +1,119 @@ |
|||
{ |
|||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", |
|||
"version": 1, |
|||
"newProjectRoot": "projects", |
|||
"projects": { |
|||
"weather": { |
|||
"projectType": "application", |
|||
"schematics": { |
|||
"@schematics/angular:component": { |
|||
"style": "scss" |
|||
} |
|||
}, |
|||
"root": "", |
|||
"sourceRoot": "src", |
|||
"prefix": "app", |
|||
"architect": { |
|||
"build": { |
|||
"builder": "@angular-devkit/build-angular:browser", |
|||
"options": { |
|||
"outputPath": "dist/weather", |
|||
"index": "src/index.html", |
|||
"main": "src/main.ts", |
|||
"polyfills": "src/polyfills.ts", |
|||
"tsConfig": "tsconfig.app.json", |
|||
"inlineStyleLanguage": "scss", |
|||
"assets": [ |
|||
"src/favicon.ico", |
|||
"src/assets", |
|||
"src/.htaccess", |
|||
"src/api", |
|||
"src/uploads" |
|||
], |
|||
"styles": [ |
|||
"src/assets/scss/main.scss" |
|||
], |
|||
"scripts": [] |
|||
}, |
|||
"configurations": { |
|||
"production": { |
|||
"budgets": [ |
|||
{ |
|||
"type": "initial", |
|||
"maximumWarning": "8mb", |
|||
"maximumError": "10mb" |
|||
}, |
|||
{ |
|||
"type": "anyComponentStyle", |
|||
"maximumWarning": "80kb", |
|||
"maximumError": "100kb" |
|||
} |
|||
], |
|||
"fileReplacements": [ |
|||
{ |
|||
"replace": "src/environments/environment.ts", |
|||
"with": "src/environments/environment.prod.ts" |
|||
} |
|||
], |
|||
"outputHashing": "all" |
|||
}, |
|||
"development": { |
|||
"buildOptimizer": false, |
|||
"optimization": false, |
|||
"vendorChunk": true, |
|||
"extractLicenses": false, |
|||
"sourceMap": true, |
|||
"namedChunks": true |
|||
} |
|||
}, |
|||
"defaultConfiguration": "production" |
|||
}, |
|||
"serve": { |
|||
"builder": "@angular-devkit/build-angular:dev-server", |
|||
"options": { |
|||
"browserTarget": "weather:build", |
|||
"proxyConfig": "proxy.conf.json" |
|||
}, |
|||
"configurations": { |
|||
"production": { |
|||
"browserTarget": "weather:build:production", |
|||
"proxyConfig": "proxy.conf.prod.json" |
|||
}, |
|||
"development": { |
|||
"browserTarget": "weather:build:development", |
|||
"proxyConfig": "proxy.conf.json" |
|||
} |
|||
}, |
|||
"defaultConfiguration": "development" |
|||
}, |
|||
"extract-i18n": { |
|||
"builder": "@angular-devkit/build-angular:extract-i18n", |
|||
"options": { |
|||
"browserTarget": "weather:build" |
|||
} |
|||
}, |
|||
"test": { |
|||
"builder": "@angular-devkit/build-angular:karma", |
|||
"options": { |
|||
"main": "src/test.ts", |
|||
"polyfills": "src/polyfills.ts", |
|||
"tsConfig": "tsconfig.spec.json", |
|||
"karmaConfig": "karma.conf.js", |
|||
"inlineStyleLanguage": "scss", |
|||
"assets": [ |
|||
"src/favicon.ico", |
|||
"src/assets", |
|||
"src/.htaccess", |
|||
"src/api", |
|||
"src/uploads" |
|||
], |
|||
"styles": [ |
|||
"src/assets/scss/main.scss" |
|||
], |
|||
"scripts": [] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
// Karma configuration file, see link for more information
|
|||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|||
|
|||
module.exports = function (config) { |
|||
config.set({ |
|||
basePath: '', |
|||
frameworks: ['jasmine', '@angular-devkit/build-angular'], |
|||
plugins: [ |
|||
require('karma-jasmine'), |
|||
require('karma-chrome-launcher'), |
|||
require('karma-jasmine-html-reporter'), |
|||
require('karma-coverage'), |
|||
require('@angular-devkit/build-angular/plugins/karma') |
|||
], |
|||
client: { |
|||
jasmine: { |
|||
// you can add configuration options for Jasmine here
|
|||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|||
// for example, you can disable the random execution with `random: false`
|
|||
// or set a specific seed with `seed: 4321`
|
|||
}, |
|||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|||
}, |
|||
jasmineHtmlReporter: { |
|||
suppressAll: true // removes the duplicated traces
|
|||
}, |
|||
coverageReporter: { |
|||
dir: require('path').join(__dirname, './coverage/weather'), |
|||
subdir: '.', |
|||
reporters: [ |
|||
{ type: 'html' }, |
|||
{ type: 'text-summary' } |
|||
] |
|||
}, |
|||
reporters: ['progress', 'kjhtml'], |
|||
port: 9876, |
|||
colors: true, |
|||
logLevel: config.LOG_INFO, |
|||
autoWatch: true, |
|||
browsers: ['Chrome'], |
|||
singleRun: false, |
|||
restartOnFileChange: true |
|||
}); |
|||
}; |
@ -0,0 +1,41 @@ |
|||
{ |
|||
"name": "weather", |
|||
"version": "0.0.0", |
|||
"scripts": { |
|||
"dev": "export NODE_OPTIONS=--openssl-legacy-provider && ng serve", |
|||
"prod": "export NODE_OPTIONS=--openssl-legacy-provider && ng build --configuration production --base-href /weather/", |
|||
"deploy": "yarn prod && sh deploy.sh" |
|||
}, |
|||
"private": true, |
|||
"dependencies": { |
|||
"@angular/animations": "^14.0.0", |
|||
"@angular/common": "^14.0.0", |
|||
"@angular/compiler": "^14.0.0", |
|||
"@angular/core": "^14.0.0", |
|||
"@angular/forms": "^14.0.0", |
|||
"@angular/platform-browser": "^14.0.0", |
|||
"@angular/platform-browser-dynamic": "^14.0.0", |
|||
"@angular/router": "^14.0.0", |
|||
"@popperjs/core": "^2.11.6", |
|||
"bootstrap": "^5.2.3", |
|||
"echarts": "^5.4.1", |
|||
"hamburgers": "^1.2.1", |
|||
"ngx-echarts": "14", |
|||
"rxjs": "~7.5.0", |
|||
"tslib": "^2.3.0", |
|||
"zone.js": "~0.11.4" |
|||
}, |
|||
"devDependencies": { |
|||
"@angular-devkit/build-angular": "^14.2.1", |
|||
"@angular/cli": "~14.2.1", |
|||
"@angular/compiler-cli": "^14.0.0", |
|||
"@types/jasmine": "~4.0.0", |
|||
"jasmine-core": "~4.3.0", |
|||
"karma": "~6.4.0", |
|||
"karma-chrome-launcher": "~3.1.0", |
|||
"karma-coverage": "~2.2.0", |
|||
"karma-jasmine": "~5.1.0", |
|||
"karma-jasmine-html-reporter": "~2.0.0", |
|||
"typescript": "~4.7.2" |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
|
|||
{ |
|||
"/api/*": { |
|||
"target": "http://weatherapi.local", |
|||
"secure": false, |
|||
"changeOrigin": true, |
|||
"logLevel": "debug" |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
|
|||
{ |
|||
"/api/*": { |
|||
"target": "http://2.233.91.82/weather/api", |
|||
"secure": false, |
|||
"changeOrigin": true, |
|||
"logLevel": "debug" |
|||
} |
|||
} |
@ -0,0 +1,3 @@ |
|||
RewriteEngine On |
|||
RewriteCond %{REQUEST_FILENAME} !-f |
|||
RewriteRule ^([^\.]+)$ $1.php [NC,L] |
@ -0,0 +1,7 @@ |
|||
<?php |
|||
|
|||
$GLOBALS['CONF']['DB']['HOST'] = 'localhost'; |
|||
$GLOBALS['CONF']['DB']['USER'] = 'root'; |
|||
$GLOBALS['CONF']['DB']['PASS'] = 'root'; |
|||
|
|||
?> |
@ -0,0 +1,33 @@ |
|||
<?php |
|||
@include 'config.php'; |
|||
@include 'headers.php'; |
|||
|
|||
$conn = @mysqli_connect($CONF['DB']['HOST'], $CONF['DB']['USER'], $CONF['DB']['PASS'], 'weather')or die("CONNECTION ERROR"); |
|||
|
|||
$day = $_GET['day']; |
|||
|
|||
$q = mysqli_query($conn, "SELECT * FROM `data` WHERE `date` LIKE '$day%'"); |
|||
|
|||
if($q) { |
|||
|
|||
$list = array(); |
|||
|
|||
while($row = mysqli_fetch_assoc($q)) { |
|||
$list[] = $row; |
|||
} |
|||
|
|||
http_response_code(200); |
|||
echo json_encode(array( |
|||
"status" => 200, |
|||
"items" => $list |
|||
)); |
|||
|
|||
} else { |
|||
http_response_code(400); |
|||
echo json_encode(array( |
|||
"status" => 400, |
|||
"message" => "Error executing query" |
|||
)); |
|||
|
|||
} |
|||
?> |
@ -0,0 +1,9 @@ |
|||
<?php |
|||
|
|||
header("Access-Control-Allow-Origin: *"); |
|||
header("Content-Type: application/json; charset=UTF-8"); |
|||
header("Access-Control-Allow-Methods: POST,GET"); |
|||
header("Access-Control-Max-Age: 3600"); |
|||
|
|||
?> |
|||
|
@ -0,0 +1,25 @@ |
|||
<?php |
|||
@include 'config.php'; |
|||
@include 'headers.php'; |
|||
|
|||
$conn = @mysqli_connect($CONF['DB']['HOST'], $CONF['DB']['USER'], $CONF['DB']['PASS'], 'weather')or die("CONNECTION ERROR"); |
|||
|
|||
$data = explode('|',$_GET['data']); |
|||
|
|||
$query = "INSERT INTO `data` VALUES(NULL, NOW(), ".$data[0].", ".$data[1].", ".$data[2].", ".$data[3].", ".$data[4].")"; |
|||
|
|||
if(mysqli_query($conn, $query)) { |
|||
http_response_code(200); |
|||
echo json_encode(array( |
|||
"status" => 200, |
|||
"message" => "Data succesfully added" |
|||
)); |
|||
} else { |
|||
http_response_code(400); |
|||
echo json_encode(array( |
|||
"status" => 400, |
|||
"message" => "Error executing query".$query |
|||
)); |
|||
|
|||
} |
|||
?> |
@ -0,0 +1 @@ |
|||
<p>app-layout works!</p> |
@ -0,0 +1,23 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { AppLayoutComponent } from './app-layout.component'; |
|||
|
|||
describe('AppLayoutComponent', () => { |
|||
let component: AppLayoutComponent; |
|||
let fixture: ComponentFixture<AppLayoutComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ AppLayoutComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
|
|||
fixture = TestBed.createComponent(AppLayoutComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
@ -0,0 +1,15 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
|
|||
@Component({ |
|||
selector: 'app-app-layout', |
|||
templateUrl: './app-layout.component.html', |
|||
styleUrls: ['./app-layout.component.scss'] |
|||
}) |
|||
export class AppLayoutComponent implements OnInit { |
|||
|
|||
constructor() { } |
|||
|
|||
ngOnInit(): void { |
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
<header class="header"> |
|||
<span class="title">{{title}}</span> |
|||
<div class="menu"> |
|||
<div class="hamburger hamburger--spin" [ngClass]="{'is-active': menuOpen}" (click)="toggleMenu()"> |
|||
<div class="hamburger-box"> |
|||
<div class="hamburger-inner"></div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="menu-items" [@slideInOut]="menuOpen ? 'open' : 'close'"> |
|||
<div class="item" (click)="toggleMenu()">Capaccio</div> |
|||
<div class="item" (click)="toggleMenu()">Pisciotta</div> |
|||
</div> |
|||
</header> |
|||
|
|||
<main class="main-content"> |
|||
<app-dashboard [day]="day"></app-dashboard> |
|||
</main> |
@ -0,0 +1,71 @@ |
|||
@import "../assets/scss/variables"; |
|||
|
|||
.header { |
|||
position: fixed; |
|||
display: flex; |
|||
top: 0; |
|||
left: 0; |
|||
height: $header-height-mobile; |
|||
width: 100%; |
|||
background: $dark-gray; |
|||
background-color: rgb(32, 32, 32); |
|||
background-image: linear-gradient(45deg, $dark-gray 25%, transparent 25%, transparent 75%, $dark-gray 75%, $dark-gray), |
|||
linear-gradient(45deg, $dark-gray 25%, transparent 25%, transparent 75%, $dark-gray 75%, $dark-gray), |
|||
linear-gradient(to bottom, $black-alpha, $dark-gray); |
|||
background-size: 10px 10px, 10px 10px, 10px 5px; |
|||
background-position: 0px 0px, 5px 5px, 0px 0px; |
|||
z-index: 100; |
|||
|
|||
@media (min-width: map-get($grid-breakpoints, 'md')) { |
|||
height: $header-height; |
|||
} |
|||
|
|||
.title { |
|||
display: block; |
|||
padding: 0 50px; |
|||
font-family: $font-serif; |
|||
font-size: $font-30; |
|||
font-weight: bold; |
|||
color: $white-alpha; |
|||
margin: auto auto 15px auto; |
|||
text-shadow: 0 0 2px $black; |
|||
} |
|||
|
|||
.menu { |
|||
position: absolute; |
|||
top: 20px; |
|||
right: 20px; |
|||
height: $hamburger-layer-width; |
|||
width: $hamburger-layer-width; |
|||
overflow: visible; |
|||
} |
|||
|
|||
.menu-items { |
|||
position: absolute; |
|||
display: block; |
|||
top: $header-height-mobile; |
|||
left: 0; |
|||
width: 100%; |
|||
height: calc(100vh - $header-height-mobile); |
|||
background: $white; |
|||
overflow: hidden; |
|||
|
|||
@media (min-width: map-get($grid-breakpoints, 'md')) { |
|||
top: $header-height; |
|||
height: calc(100vh - $header-height-mobile); |
|||
} |
|||
|
|||
.item { |
|||
display: block; |
|||
background: $white; |
|||
padding: 20px; |
|||
font-size: $font-34; |
|||
font-family: $font-serif; |
|||
text-align: center; |
|||
text-transform: uppercase; |
|||
color: $dark-gray; |
|||
border-bottom: 1px dotted $black-alpha; |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,31 @@ |
|||
import { TestBed } from '@angular/core/testing'; |
|||
import { AppComponent } from './app.component'; |
|||
|
|||
describe('AppComponent', () => { |
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ |
|||
AppComponent |
|||
], |
|||
}).compileComponents(); |
|||
}); |
|||
|
|||
it('should create the app', () => { |
|||
const fixture = TestBed.createComponent(AppComponent); |
|||
const app = fixture.componentInstance; |
|||
expect(app).toBeTruthy(); |
|||
}); |
|||
|
|||
it(`should have as title 'weather'`, () => { |
|||
const fixture = TestBed.createComponent(AppComponent); |
|||
const app = fixture.componentInstance; |
|||
expect(app.title).toEqual('weather'); |
|||
}); |
|||
|
|||
it('should render title', () => { |
|||
const fixture = TestBed.createComponent(AppComponent); |
|||
fixture.detectChanges(); |
|||
const compiled = fixture.nativeElement as HTMLElement; |
|||
expect(compiled.querySelector('.content span')?.textContent).toContain('weather app is running!'); |
|||
}); |
|||
}); |
@ -0,0 +1,33 @@ |
|||
import { Component } from '@angular/core' |
|||
import { trigger, state, style, animate, transition } from '@angular/animations' |
|||
|
|||
@Component({ |
|||
selector: 'app-root', |
|||
templateUrl: './app.component.html', |
|||
styleUrls: ['./app.component.scss'], |
|||
animations: [ |
|||
trigger('slideInOut', [ |
|||
state('close', style({ |
|||
opacity: '0', |
|||
height: '0px' |
|||
})), |
|||
state('open', style({ |
|||
opacity: '1', |
|||
height: '*' |
|||
})), |
|||
transition('close => open', animate('300ms ease-in-out')), |
|||
transition('open => close', animate('300ms ease-in-out')) |
|||
]) |
|||
] |
|||
}) |
|||
|
|||
export class AppComponent { |
|||
|
|||
public title: string = 'Dslak weather station' |
|||
public day: string = new Date().toISOString().substring(0,10) |
|||
public menuOpen: boolean = false |
|||
|
|||
toggleMenu(): void { |
|||
this.menuOpen = !this.menuOpen |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
import { NgModule } from '@angular/core'; |
|||
import { FormsModule } from '@angular/forms'; |
|||
import { BrowserModule } from '@angular/platform-browser'; |
|||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; |
|||
import { HttpClientModule } from '@angular/common/http'; |
|||
import { NgxEchartsModule } from 'ngx-echarts'; |
|||
import { environment } from '../environments/environment' |
|||
|
|||
import { AppComponent } from './app.component'; |
|||
import { AppLayoutComponent } from './app-layout/app-layout.component'; |
|||
import { GraphComponent } from './graph/graph.component'; |
|||
import { DashboardComponent } from './dashboard/dashboard.component'; |
|||
|
|||
@NgModule({ |
|||
declarations: [ |
|||
AppComponent, |
|||
AppLayoutComponent, |
|||
GraphComponent, |
|||
DashboardComponent |
|||
], |
|||
imports: [ |
|||
BrowserModule, |
|||
FormsModule, |
|||
BrowserAnimationsModule, |
|||
HttpClientModule, |
|||
NgxEchartsModule.forRoot({ |
|||
echarts: () => import('echarts') |
|||
}) |
|||
], |
|||
providers: [], |
|||
bootstrap: [AppComponent] |
|||
}) |
|||
export class AppModule { } |
@ -0,0 +1,3 @@ |
|||
<div class="dashboard-container"> |
|||
<app-graph [data]="data"></app-graph> |
|||
</div> |
@ -0,0 +1,23 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { DashboardComponent } from './dashboard.component'; |
|||
|
|||
describe('DashboardComponent', () => { |
|||
let component: DashboardComponent; |
|||
let fixture: ComponentFixture<DashboardComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ DashboardComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
|
|||
fixture = TestBed.createComponent(DashboardComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
@ -0,0 +1,37 @@ |
|||
import { Component, OnInit, Input, ViewEncapsulation } from '@angular/core' |
|||
import { StationService } from '../station.service' |
|||
import { environment } from '../../environments/environment' |
|||
|
|||
@Component({ |
|||
selector: 'app-dashboard', |
|||
templateUrl: './dashboard.component.html', |
|||
styleUrls: ['./dashboard.component.scss'], |
|||
encapsulation: ViewEncapsulation.None |
|||
}) |
|||
|
|||
export class DashboardComponent implements OnInit { |
|||
|
|||
@Input() day: string = '' |
|||
public data: any = [] |
|||
|
|||
constructor( |
|||
private stationService: StationService |
|||
) { } |
|||
|
|||
ngOnInit(): void { |
|||
if(this.day) this.getData() |
|||
} |
|||
|
|||
getData(): void { |
|||
this.stationService.getData(this.day).toPromise().then( (data) => { |
|||
console.log(data) |
|||
this.data = data.items |
|||
},(error) => { |
|||
console.error(error) |
|||
}).catch((e) => { |
|||
console.error(e) |
|||
}) |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,6 @@ |
|||
<div class="graph"> |
|||
<div class="canvas-container"> |
|||
<div echarts class="canvas" [options]="graph.options" (chartInit)="onChartInit($event, graph)"></div> |
|||
<div class="canvas-loader" *ngIf="graph.loading"><div class="spinner"></div></div> |
|||
</div> |
|||
</div> |
@ -0,0 +1,76 @@ |
|||
@import "../../assets/scss/variables"; |
|||
|
|||
.graph { |
|||
position: relative; |
|||
display: block; |
|||
background: $white; |
|||
border-radius: 3px; |
|||
padding: 0px; |
|||
width: 100%; |
|||
height: calc(100vh - $header-height-mobile); |
|||
@media (min-width: map-get($grid-breakpoints, 'md')) { |
|||
height: calc(100vh - $header-height-mobile); |
|||
} |
|||
|
|||
.canvas-container { |
|||
position: relative; |
|||
display: block; |
|||
border-radius: 3px; |
|||
padding: 0px; |
|||
height: calc(100vh - $header-height-mobile); |
|||
@media (min-width: map-get($grid-breakpoints, 'md')) { |
|||
height: calc(100vh - $header-height-mobile); |
|||
} |
|||
|
|||
.canvas-loader { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
border-radius: 3px; |
|||
background: $white; |
|||
margin-top: 0; |
|||
width: 100%; |
|||
height: 630px; |
|||
z-index: 1; |
|||
|
|||
>.spinner { |
|||
position: absolute; |
|||
top: calc(50% - 30px); |
|||
left: calc(50% - 30px); |
|||
border-radius: 50%; |
|||
width: 100px; |
|||
height: 100px; |
|||
border-top: 15px solid $black-alpha; |
|||
border-right: 15px solid $black-alpha; |
|||
border-bottom: 15px solid $black-alpha; |
|||
border-left: 15px solid $white; |
|||
animation: graphLoader 1s infinite linear; |
|||
&:after { |
|||
border-radius: 50%; |
|||
width: 100px; |
|||
height: 100px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.canvas { |
|||
position: relative; |
|||
display: block; |
|||
border-radius: 3px; |
|||
padding: 0px; |
|||
height: calc(100vh - $header-height-mobile); |
|||
@media (min-width: map-get($grid-breakpoints, 'md')) { |
|||
height: calc(100vh - $header-height-mobile); |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@keyframes graphLoader { |
|||
0% { transform: rotate(0deg); } |
|||
100% { transform: rotate(360deg); } |
|||
} |
@ -0,0 +1,23 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { GraphComponent } from './graph.component'; |
|||
|
|||
describe('GraphComponent', () => { |
|||
let component: GraphComponent; |
|||
let fixture: ComponentFixture<GraphComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ GraphComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
|
|||
fixture = TestBed.createComponent(GraphComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue