Heatindex en weervoorspelling

This commit is contained in:
Groamer
2014-10-17 14:44:14 +02:00
parent 2c1c124930
commit 70a3c3fdb0
4 changed files with 95 additions and 3 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ public class Measurement
// solarRad
public void setRawSolarRad (short val) { this.solarRad = val;};
public short getRawSolarRad () { return solarRad; };
public double getSolarRad () { return Calculator.solarRad(solarRad); };
public double getSolarRad () {return Calculator.solarRad(solarRad);}
// xmitBatt
+89
View File
@@ -0,0 +1,89 @@
import java.util.ArrayList;
public class Voorspellingen extends Grootheid{
public ArrayList<Double> list;
//constructor
public Voorspellingen(Measurement measurement1){
updateRecent(measurement1);
}
public void updateRecent(Measurement measurement1){
setCurrent(measurement1.getBarometer());
}
public void display()
{
if (getCurrent() >= 1033 && getCurrent() <= 1084)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "mooi weer", "");
GUIboard.writeUpperDigits(10);
}
else
if (getCurrent() >= 1030 && getCurrent() <= 1033)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "mooi weer", "");
GUIboard.writeUpperDigits(10);
}
else
if (getCurrent() >= 1020 && getCurrent() <= 1030)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "goed weer", "");
GUIboard.writeUpperDigits(20);
}
else
if (getCurrent() >= 1015 && getCurrent() <= 1020)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "wisselvallig weer", "");
GUIboard.writeUpperDigits(30);
}
else
if (getCurrent() >= 1010 && getCurrent() <= 1015)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "wisselvallig weer", "");
GUIboard.writeUpperDigits(40);
}
else
if (getCurrent() >= 1007 && getCurrent() <= 1010)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "wisselvallig weer", "");
GUIboard.writeUpperDigits(50);
}
else
if (getCurrent() >= 1003 && getCurrent() <= 1007)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "regen of wind", "");
GUIboard.writeUpperDigits(60);
}
else
if (getCurrent() >= 1000 && getCurrent() <= 1003)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "regen of wind", "");
GUIboard.writeUpperDigits(70);
}
else
if (getCurrent() >= 990 && getCurrent() <= 1000)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "regen of wind", "");
GUIboard.writeUpperDigits(80);
}
else
if (getCurrent() >= 980 && getCurrent() <= 990)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "veel regen", "");
GUIboard.writeUpperDigits(90);
}
else
if (getCurrent() >= 970 && getCurrent() <= 980)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "storm", "");
GUIboard.writeUpperDigits(90);
}
else
if (getCurrent() >= 870 && getCurrent() <= 970)
{
GUIboard.writePageToMatrix("Weersvoorspelling:", "zware storm", "");
GUIboard.writeUpperDigits(90);
}
}
}
+2
View File
@@ -47,11 +47,13 @@ public class Weerstation {
//All the different screen classes
final List<Grootheid> lstScreens = new ArrayList<Grootheid>();
lstScreens.add(new OutsideTemp(meting1, meting2));
lstScreens.add(new WindChill(meting1, meting2));
lstScreens.add(new HeatIndex(meting1, meting2));
lstScreens.add(new OutsideHum(meting1, meting2));
lstScreens.add(new Barometer(meting1, meting2));
lstScreens.add(new Voorspellingen(meting1));
lstScreens.add(new AvgWindSpeed(meting1, meting2));
lstScreens.add(new RainRate(meting1, meting2));
lstScreens.add(new InsideTemp(meting1, meting2));
+2 -1
View File
@@ -25,6 +25,7 @@ public class WeerstationConnector
//Start connection with Databse
public WeerstationConnector(String host, String port, String dbName, String userName, String password)
{
System.out.println("Verbinding maken met de database...\n");
try
{
String url = "jdbc:mysql://" + host + ":" + port + "/"+ dbName + "?user="
@@ -33,7 +34,7 @@ public class WeerstationConnector
+ password;
Class.forName("com.mysql.jdbc.Driver").newInstance ();
myConn = DriverManager.getConnection(url);
System.out.println("Database connection established");
System.out.println("Verbonden met de database");
}
catch( SQLException ex)
{