Dependencies:   mbed

Committer:
ladner
Date:
Fri May 13 11:46:11 2016 +0000
Revision:
7:a1041bc1d084
Parent:
6:e7592436c025

        

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
ladner 5:0aca0f5d4367 4 Modiried by: Jakob Ladner
Enenkel 0:a8a0195ed7dc 5 description:
Enenkel 4:69cc6cb35799 6 Test 4 Stk Incrementgeber.
Enenkel 4:69cc6cb35799 7 Beim Ansprechen des Incrementgebers leuchten LED
Enenkel 0:a8a0195ed7dc 8 ***********************************/
Enenkel 0:a8a0195ed7dc 9 #include "mbed.h"
Enenkel 1:d646fe79bc6c 10
Enenkel 4:69cc6cb35799 11 DigitalOut Von (P2_13); // 12 V ON
Enenkel 4:69cc6cb35799 12 DigitalOut INCON (P2_2); // Incrementgeber ON
Enenkel 4:69cc6cb35799 13 DigitalIn INC1 (P2_6); // Incremenrtgeber U17
Enenkel 4:69cc6cb35799 14 DigitalIn INC2 (P2_7); // U20
Enenkel 4:69cc6cb35799 15 DigitalIn INC3 (P2_8); // U21
Enenkel 4:69cc6cb35799 16 DigitalIn INC4 (P2_9); // U22
ladner 6:e7592436c025 17
Enenkel 4:69cc6cb35799 18 DigitalOut LedD10 (P1_18); // Led D10
ladner 5:0aca0f5d4367 19 DigitalOut LedD11 (P2_16); // Led D11
ladner 7:a1041bc1d084 20 DigitalOut LedD13 (P1_21); // Led D13
ladner 5:0aca0f5d4367 21 DigitalOut LedD12 (P1_20); // Led D12
Enenkel 2:90c675f0505a 22
Enenkel 0:a8a0195ed7dc 23 int main() {
Enenkel 4:69cc6cb35799 24 Von=1; // 12 V Leitung EIN
Enenkel 4:69cc6cb35799 25 INCON=1; // incrementgeber EIN
Enenkel 2:90c675f0505a 26
Enenkel 0:a8a0195ed7dc 27 while(1) {
Enenkel 1:d646fe79bc6c 28 // Auswertung der LINE SENSOREN
Enenkel 4:69cc6cb35799 29 if (INC1 == 1 ) // Incr. Sensor U17
Enenkel 1:d646fe79bc6c 30 {
Enenkel 4:69cc6cb35799 31 LedD10=1;
Enenkel 2:90c675f0505a 32 } else{
Enenkel 2:90c675f0505a 33 LedD10=0;
Enenkel 2:90c675f0505a 34 }
Enenkel 4:69cc6cb35799 35 if (INC2 == 1)
Enenkel 2:90c675f0505a 36 {
Enenkel 2:90c675f0505a 37 LedD11=1;
Enenkel 2:90c675f0505a 38 } else {
Enenkel 2:90c675f0505a 39 LedD11=0;
Enenkel 2:90c675f0505a 40 }
Enenkel 4:69cc6cb35799 41 if (INC3 == 1)
Enenkel 1:d646fe79bc6c 42 {
Enenkel 4:69cc6cb35799 43 LedD13=1;
Enenkel 4:69cc6cb35799 44 } else {
Enenkel 4:69cc6cb35799 45 LedD13=0;
Enenkel 4:69cc6cb35799 46 }
Enenkel 4:69cc6cb35799 47 if (INC4 == 1)
Enenkel 4:69cc6cb35799 48 {
Enenkel 4:69cc6cb35799 49 LedD12=1;
Enenkel 2:90c675f0505a 50 } else{
Enenkel 4:69cc6cb35799 51 LedD12=0;
Enenkel 2:90c675f0505a 52 }
Enenkel 0:a8a0195ed7dc 53 }
Enenkel 0:a8a0195ed7dc 54 }
Enenkel 0:a8a0195ed7dc 55