Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| efinf:blc2016:bu1:projekt1:projekt [2017/03/16 13:40] – raphael_waespi | efinf:blc2016:bu1:projekt1:projekt [2017/03/16 20:45] (current) – [Code:] Ivo Blöchliger | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | {{backlinks> | ||
| + | ====== Branchium Aquae ===== | ||
| + | ==== Sebastian Andres & Raphael Wäspi ==== | ||
| + | ==== Idee und Fernziel: ==== | ||
| + | Bau eines Feuchtigkeitsmessinstruments, | ||
| + | |||
| + | ==== Minimalprojekt: | ||
| + | |||
| + | Bau eines Feuchtigkeitsmessinstruments, | ||
| + | |||
| + | |||
| + | ===== Bericht: ===== | ||
| + | ==== Material: ==== | ||
| + | Arduino | ||
| + | MicroServo SG90 | ||
| + | 4-digit 7-segment display | ||
| + | Soil Moisture Sensor YL-69 | ||
| + | ==== Aufbau: ==== | ||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ==== Code: ==== | ||
| + | <code c++> | ||
| + | #include < | ||
| + | #include < | ||
| + | int servoPin = 9; | ||
| + | const int CLK = 12; //Set the CLK pin connection to the display | ||
| + | const int DIO = 11; //Set the DIO pin connection to the display | ||
| + | Servo servo; | ||
| + | int rainPin = A0; | ||
| + | int greenLED = 6; | ||
| + | int redLED = 7; | ||
| + | int yellowLED = 4; | ||
| + | // you can adjust the threshold value | ||
| + | int thresholdValue = 700; | ||
| + | int servoAngle = 0; // servo position in degrees | ||
| + | int NumStep = 0; //Variable to interate | ||
| + | TM1637Display display(CLK, | ||
| + | |||
| + | void setup(){ | ||
| + | pinMode(rainPin, | ||
| + | pinMode(greenLED, | ||
| + | pinMode(redLED, | ||
| + | pinMode(yellowLED, | ||
| + | digitalWrite(greenLED, | ||
| + | digitalWrite(redLED, | ||
| + | digitalWrite(yellowLED, | ||
| + | Serial.begin(9600); | ||
| + | servo.attach(servoPin); | ||
| + | display.setBrightness(0x0a); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // read the input on analog pin 0: | ||
| + | int sensorValue = analogRead(rainPin); | ||
| + | Serial.print(sensorValue); | ||
| + | if(sensorValue > thresholdValue-100 && sensorValue < thresholdValue){ | ||
| + | Serial.println(" | ||
| + | digitalWrite(redLED, | ||
| + | digitalWrite(greenLED, | ||
| + | digitalWrite(yellowLED, | ||
| + | display.showNumberDec(sensorValue); | ||
| + | delay(500); | ||
| + | } | ||
| + | else if(sensorValue < thresholdValue){ | ||
| + | Serial.println(" | ||
| + | digitalWrite(redLED, | ||
| + | digitalWrite(greenLED, | ||
| + | digitalWrite(yellowLED, | ||
| + | display.showNumberDec(sensorValue); | ||
| + | delay(500); | ||
| + | servo.detach(); | ||
| + | | ||
| + | | ||
| + | } | ||
| + | else if (sensorValue > thresholdValue){ | ||
| + | servo.attach(servoPin); | ||
| + | Serial.println(" | ||
| + | digitalWrite(redLED, | ||
| + | digitalWrite(greenLED, | ||
| + | digitalWrite(yellowLED, | ||
| + | display.showNumberDec(sensorValue); | ||
| + | delay(500); | ||
| + | servo.write(1); | ||
| + | delay(2000); | ||
| + | for (int i=1; i<136; i++) { | ||
| + | servo.write(i); | ||
| + | delay(10); | ||
| + | } | ||
| + | servo.write(135); | ||
| + | |||
| + | } | ||
| + | | ||
| + | delay(60000); | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Servobox: ==== | ||
| + | {{ : | ||
| + | |||
| + | Rest (Achtung: Sevobox ersetzen): {{ : | ||
| + | |||
| + | |||
| + | ==== Fazit: ==== | ||
| + | |||
| + | Dieses Projekt haben wir in 4 Tagen beendet. | ||
| + | |||
| + | ==== Fotos und Film: ==== | ||
| + | |||