Dependencies:   mbed

Committer:
Enenkel
Date:
Thu Apr 21 12:19:10 2016 +0000
Revision:
4:69cc6cb35799
Parent:
3:5c3f86316047
Child:
5:0aca0f5d4367
BERTL16 Incrementgeber Test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Enenkel 0:a8a0195ed7dc 1 /***********************************
Enenkel 4:69cc6cb35799 2 Name: BERTL16 Incrementgeber TEST
MehmedCustic 3:5c3f86316047 3 Author: Enenkel
Enenkel 0:a8a0195ed7dc 4 description:
Enenkel 4:69cc6cb35799 5 Test 4 Stk Incrementgeber.
Enenkel 4:69cc6cb35799 6 Beim Ansprechen des Incrementgebers leuchten LED
Enenkel 0:a8a0195ed7dc 7 ***********************************/
Enenkel 0:a8a0195ed7dc 8 #include "mbed.h"
Enenkel 1:d646fe79bc6c 9
Enenkel 4:69cc6cb35799 10 DigitalOut Von (P2_13); // 12 V ON
Enenkel 4:69cc6cb35799 11 DigitalOut INCON (P2_2); // Incrementgeber ON
Enenkel 4:69cc6cb35799 12 DigitalIn INC1 (P2_6); // Incremenrtgeber U17
Enenkel 4:69cc6cb35799 13 DigitalIn INC2 (P2_7); // U20
Enenkel 4:69cc6cb35799 14 DigitalIn INC3 (P2_8); // U21
Enenkel 4:69cc6cb35799 15 DigitalIn INC4 (P2_9); // U22
Enenkel 2:90c675f0505a 16
Enenkel 4:69cc6cb35799 17 DigitalOut LedD10 (P1_18); // Led D10
Enenkel 4:69cc6cb35799 18 DigitalOut LedD11 (P1_16);
Enenkel 4:69cc6cb35799 19 DigitalOut LedD13 (P1_21);
Enenkel 4:69cc6cb35799 20 DigitalOut LedD12 (P1_20);
Enenkel 2:90c675f0505a 21
Enenkel 0:a8a0195ed7dc 22 int main() {
Enenkel 4:69cc6cb35799 23 Von=1; // 12 V Leitung EIN
Enenkel 4:69cc6cb35799 24 INCON=1; // incrementgeber EIN
Enenkel 2:90c675f0505a 25
Enenkel 0:a8a0195ed7dc 26 while(1) {
Enenkel 1:d646fe79bc6c 27 // Auswertung der LINE SENSOREN
Enenkel 4:69cc6cb35799 28 if (INC1 == 1 ) // Incr. Sensor U17
Enenkel 1:d646fe79bc6c 29 {
Enenkel 4:69cc6cb35799 30 LedD10=1;
Enenkel 2:90c675f0505a 31 } else{
Enenkel 2:90c675f0505a 32 LedD10=0;
Enenkel 2:90c675f0505a 33 }
Enenkel 4:69cc6cb35799 34 if (INC2 == 1)
Enenkel 2:90c675f0505a 35 {
Enenkel 2:90c675f0505a 36 LedD11=1;
Enenkel 2:90c675f0505a 37 } else {
Enenkel 2:90c675f0505a 38 LedD11=0;
Enenkel 2:90c675f0505a 39 }
Enenkel 4:69cc6cb35799 40 if (INC3 == 1)
Enenkel 1:d646fe79bc6c 41 {
Enenkel 4:69cc6cb35799 42 LedD13=1;
Enenkel 4:69cc6cb35799 43 } else {
Enenkel 4:69cc6cb35799 44 LedD13=0;
Enenkel 4:69cc6cb35799 45 }
Enenkel 4:69cc6cb35799 46 if (INC4 == 1)
Enenkel 4:69cc6cb35799 47 {
Enenkel 4:69cc6cb35799 48 LedD12=1;
Enenkel 2:90c675f0505a 49 } else{
Enenkel 4:69cc6cb35799 50 LedD12=0;
Enenkel 2:90c675f0505a 51 }
Enenkel 0:a8a0195ed7dc 52 }
Enenkel 0:a8a0195ed7dc 53 }
Enenkel 0:a8a0195ed7dc 54