Project

General

Profile

Statistics
| Branch: | Revision:

pse-2015-16-grupo-3 / tpf / io.c @ ac0f8544

History | View | Annotate | Download (1.02 KB)

1
/* 
2
 * File:   io.c
3
 * Author: gustavobica
4
 *
5
 * Created on 02 November 2015, 16:49
6
 */
7

    
8
#include <stdio.h>
9
#include <stdlib.h>
10
#include "config.h"
11
#include <wiringPi.h>
12
/*
13
 * 
14
 */
15

    
16

    
17
    
18
    uint8_t turnOnLight(){
19
        digitalWrite (INSIDE_LIGHT, HIGH) ;
20
        return 0;
21
    }
22
    uint8_t turnOffLight(){
23
        digitalWrite(INSIDE_LIGHT,LOW);
24
        return 0;
25
    }
26
     uint8_t turnOffMegatron(){
27
        digitalWrite(WAVE_LED,LOW);
28
        return 0;
29
    }
30
     uint8_t turnOnMegatron(){
31
        digitalWrite(WAVE_LED,HIGH);
32
        return 0;
33
    }
34
    uint8_t IsDoorOpen(uint8_t* state){
35
        
36
        
37
        if(digitalRead(DOOR_SWITCH)==HIGH)
38
        {
39
            *state=1;
40
            
41
        }else{
42
            *state=0;
43
        }
44
        return 0;
45
    }
46
    uint8_t PowerOff(uint8_t* state){
47
        
48
       digitalWrite(POWER_BTN,LOW);
49
       *state=0;
50
        return 0;
51
    } 
52
    uint8_t PowerOn(uint8_t* state){
53
        
54
       *state=1; 
55
       digitalWrite(POWER_BTN,HIGH);
56
        return 0;
57
    } 
58
    
59
    
60
   
61