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
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,8 @@ public class Arduino {
int[] array = { 3, 5, 6, 9, 10, 11 };
for (int i = 0; i < 6; 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;
}
}
......
......@@ -29,7 +29,9 @@ public class Pin extends Observable {
public void setValue(int _value) {
if (_value > 1023)
_value = 1023;
//TODO: check by Lucas
//_value = 1023;
_value = _value%1024;
if (_value < 0)
_value = 0;
value = _value;
......
......@@ -85,7 +85,6 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener {
@Override
public void stateChanged(ChangeEvent arg0) {
pins.get(0).setValue(slider.getValue());
}
/**
......@@ -99,7 +98,6 @@ public class Poti extends Modul implements ChangeListener, MouseWheelListener {
} else {
slider.setValue(slider.getValue() - 10);
}
}
private void calculatePinPos() {
......
......@@ -51,7 +51,7 @@ public class RGB extends Modul {
if(greenValue>0)tgreenValue=map(greenValue);
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.fillOval(0, 0, 73, 73);
}
......@@ -71,11 +71,13 @@ public class RGB extends Modul {
*/
public void updateModul(Pin pin) {
if (pin == pins.get(0))
redValue = pin.getValue() / 4;
redValue = pin.getValue() / 4;
if (pin == pins.get(1))
blueValue = pin.getValue() / 4;
if (pin == pins.get(2))
greenValue = pin.getValue() / 4;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment