zondag 24 juni 2012

Fase 4: Component design

1.       Je kunt aangeven waarom je gekozen component past bij de beoogde prestaties.

2.    Je kunt aangeven wat de gekozen componenten bijdragen aan andere aspecten naast de beoogde (primaire) prestaties. Denk aan de roos van Pandora
De arduino  kan niet alleen een signaal door  geven aan een magneetklep maar tegelijkertijd dit signaal kan benutten om andere componenten zoals in dit geval verlichting en geluid aan te sturen.

3.    Je kunt een logisch schema om zetten in werkende programmatuur.

Dit stroom schema hier onder is omgezet naar werkende programmatuur.


Arduino programma


/*
This program reads the values from an IR sensor (DF Robot).
Low values < 'Threshholdlow' indicate that an object is within the range of the sensor.
When sensor detects an object (duration 'Detecttime' msec minimum), a solenoid must be fired (output high
for 'Holdtime' msec) and after that, the output shall not react on an input for 'Outputdelay' seconds.


Created by Matthijs de Jonge
*/

int IRsensorpin = A0; // select the Analog input pin for the IR sensor
int Sensorvalue = 0; // variabele to store the value coming from the IRsensor
int Threshholdlow = 20; // reference value when object is detected
int OutputSol = 13; // select the Digital output pin for the Solenoid
int Holdtime = 300; // opening time solenoid
int Outputdelay = 10000; // delay for bloking the fireing of the solenoid
//int Detecttime = 500; // minimum time the sensor must see the object


void setup() {
Serial.begin(9600); //initialize baud rate to 9600
pinMode(OutputSol, OUTPUT); //declare OutputSol as an OUTPUT:
}

void loop() {
Sensorvalue = analogRead(IRsensorpin); { //read value from Analog input A0
if (Sensorvalue < Threshholdlow) {
digitalWrite(OutputSol,HIGH);
delay(Holdtime);
digitalWrite(OutputSol,LOW);
delay(Outputdelay);
}
else {
digitalWrite(OutputSol,LOW);
}
}
}


4.    Je kunt de werkende programmatuur testen.
De programmatuur is getest door m'n collega en het werkt.

Geen opmerkingen:

Een reactie posten