Skip to content
Snippets Groups Projects
Commit 23a31711 authored by buehlera's avatar buehlera
Browse files

Pin-Class angepasst: Limit auf 1023 durch %1024 ersetzt

parent 575c861f
Branches
No related tags found
No related merge requests found
...@@ -135,7 +135,8 @@ public class Arduino { ...@@ -135,7 +135,8 @@ public class Arduino {
int[] array = { 3, 5, 6, 9, 10, 11 }; int[] array = { 3, 5, 6, 9, 10, 11 };
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
if (_pin == array[i]) { if (_pin == array[i]) {
pins[_pin].setValue((int) (_value * 4.012)); pins[_pin].setValue((int) (_value * (1024.0/256.0)));
//System.out.println(_value + " multi " + (int)(_value * (1024.0/256.0)));
return true; return true;
} }
} }
......
...@@ -29,7 +29,9 @@ public class Pin extends Observable { ...@@ -29,7 +29,9 @@ public class Pin extends Observable {
public void setValue(int _value) { public void setValue(int _value) {
if (_value > 1023) if (_value > 1023)
_value = 1023; //TODO: check by Lucas
//_value = 1023;
_value = _value%1024;
if (_value < 0) if (_value < 0)
_value = 0; _value = 0;
value = _value; value = _value;
......
...@@ -85,7 +85,6 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener { ...@@ -85,7 +85,6 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener {
@Override @Override
public void stateChanged(ChangeEvent arg0) { public void stateChanged(ChangeEvent arg0) {
pins.get(0).setValue(slider.getValue()); pins.get(0).setValue(slider.getValue());
} }
/** /**
...@@ -99,7 +98,6 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener { ...@@ -99,7 +98,6 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener {
} else { } else {
slider.setValue(slider.getValue() - 10); slider.setValue(slider.getValue() - 10);
} }
} }
private void calculatePinPos() { private void calculatePinPos() {
......
...@@ -51,7 +51,7 @@ public class RGB extends Modul { ...@@ -51,7 +51,7 @@ public class RGB extends Modul {
if(greenValue>0)tgreenValue=map(greenValue); if(greenValue>0)tgreenValue=map(greenValue);
if(blueValue>0)tblueValue=map(blueValue); if(blueValue>0)tblueValue=map(blueValue);
} }
System.out.println(tredValue+" "+ tgreenValue+" "+ tblueValue+" "+ transparancy); //System.out.println(tredValue+" "+ tgreenValue+" "+ tblueValue+" "+ transparancy);
ga.setPaint(new Color(tredValue, tgreenValue, tblueValue, transparancy)); ga.setPaint(new Color(tredValue, tgreenValue, tblueValue, transparancy));
ga.fillOval(0, 0, 73, 73); ga.fillOval(0, 0, 73, 73);
} }
...@@ -76,6 +76,8 @@ public class RGB extends Modul { ...@@ -76,6 +76,8 @@ public class RGB extends Modul {
blueValue = pin.getValue() / 4; blueValue = pin.getValue() / 4;
if (pin == pins.get(2)) if (pin == pins.get(2))
greenValue = pin.getValue() / 4; greenValue = pin.getValue() / 4;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment