Components and supplies
DC motor (generic)
Arduino UNO
Relay (generic)
Tools and machines
Soldering iron (generic)
Project description
Code
Autolas V 0.4
csharp
1/* 2 Autolas V 0.04 3 Auteur: Emiel van Beusekom. 4 5 Pin-layout: 6 Pin 2 = Indenticatie LED - Controller Gereed voor cyclus 7 Pin 3 = Indenticatie LED - Moter actief 8 Pin 4 = Indenticatie LED - Lastorch actief 9 Pin 6 = Cyclus Start schakelaar 10 Pin 7 = Volledige rotatie schakelaar 11 Pin 9 = Aansturing Moter 12 Pin 10 = Aansturing Lastorch 13 */ 14 15// Indenticatie LED's //Pin-layout: 16const int GereedIndLED = 2; //Pin 2 = Indenticatie LED - Controller Gereed voor cyclus 17const int MoterIndLED = 3; //Pin 3 = Indenticatie LED - Moter actief 18const int LastorchIndLED = 4; //Pin 4 = Indenticatie LED - Lastorch actief 19// Schakelaars //Pin 6 = Cyclus Start schakelaar 20int Sk01 = 6; //Pin 7 = Volledige rotatie schakelaar 21int Sk02 = 7; //Pin 9 = Aansturing Moter 22int Sk01Status = digitalRead(Sk01); //Pin 10 = Aansturing Lastorch 23// Werktuigen //Pin A0 = Potmeter startvertraging 24const int Moter = 9; //Pin A1 = Potmeter stopvertraging 25const int Lastorch = 10; //Pin A2 = Potmeter snelheid 26 27 //Identicatie LED's test. 28 void IndLEDsTest(){ 29 digitalWrite(GereedIndLED, HIGH); 30 digitalWrite(MoterIndLED, HIGH); 31 digitalWrite(LastorchIndLED, HIGH); 32 delay(500); 33 digitalWrite(GereedIndLED, LOW); 34 digitalWrite(MoterIndLED, LOW); 35 digitalWrite(LastorchIndLED, LOW); 36 delay(500); 37 } 38 39 40void setup() { 41 Serial.begin(9600); 42 Serial.println("Bezig met opstarten"); 43 44// alle pinnen worden gelinkt 45 pinMode(GereedIndLED, OUTPUT); 46 pinMode(MoterIndLED, OUTPUT); 47 pinMode(LastorchIndLED, OUTPUT); 48 pinMode(Moter, OUTPUT); 49 pinMode(Lastorch, OUTPUT); 50 pinMode(Sk01, INPUT); 51 pinMode(Sk02, INPUT); 52 53// LED Test 54 IndLEDsTest(); 55 IndLEDsTest(); 56 IndLEDsTest(); 57 IndLEDsTest(); 58 IndLEDsTest(); 59 60// Terug gaan naar correcte positie 61 while (digitalRead(7) == LOW){ 62 digitalWrite(Moter, HIGH); 63 digitalWrite(MoterIndLED, HIGH); 64 } 65 digitalWrite(Moter, LOW); 66 digitalWrite(MoterIndLED, LOW); 67 68// Opstarten voltooid 69 digitalWrite(GereedIndLED, HIGH); 70 Serial.println("Opstarten Voltooid"); 71 72} 73 74 75void loop() { 76 Serial.println(" "); 77 78 while (digitalRead(6) == LOW) { } 79 80 int Potmeter1 = analogRead(A0); 81 int Potmeter2 = analogRead(A1); 82 int Potmeter3 = analogRead(A2); 83 float StartVertraging = Potmeter1 * 5 + 150; 84 float EindVertraging = Potmeter2 * 5 + 150; 85 float Snelheid = Potmeter3 * 0.19 + 50; 86 87 Serial.println("Cyclus gestart"); 88 Serial.println("Startvertraging:"); 89 Serial.println(StartVertraging); 90 Serial.println("Stopvertraging:"); 91 Serial.println(EindVertraging); 92 Serial.println("Snelheid:"); 93 Serial.println(Snelheid); 94 Serial.println(Potmeter3); 95 96 digitalWrite(LastorchIndLED, HIGH); 97 digitalWrite(Lastorch, HIGH); 98 99 delay(StartVertraging); 100 101 digitalWrite(MoterIndLED, HIGH); 102 analogWrite(Moter, Snelheid); 103 104 while (digitalRead(7) == LOW) { } 105 106 digitalWrite(MoterIndLED, LOW); 107 digitalWrite(Moter, LOW); 108 109 delay(EindVertraging); 110 111 digitalWrite(LastorchIndLED, LOW); 112 digitalWrite(Lastorch, LOW); 113 114 Serial.println("Cyclus voltooid"); 115 Serial.println(" "); 116 delay(1); 117} 118
Downloadable files
schematic
My first schematic!
schematic
schematic
My first schematic!
schematic
Comments
Only logged in users can leave comments
emielbeus
0 Followers
•0 Projects
Table of contents
Intro
1
0