main.c


1
#include <stdbool.h>
2
#include <stdint.h>
3
#include <stdlib.h>
4
#include <avr/pgmspace.h>
5
#include "main.h"
6
#include <util/delay.h>
7
#include "i2clcd.h"
8
#include "i2cmaster.h"
9
10
#define ERROR_LED 3
11
#define NORMAL_LED 1
12
13
int main(void){
14
15
  DDRB = (1<<ERROR_LED) | (1<<NORMAL_LED);
16
  PORTB = 0x00;
17
  
18
  char localAdr1 = 0x27;
19
  char localAdr2 = 0x4E;
20
  
21
  i2c_init();
22
  lcd_init();
23
  
24
  if(i2c_start(localAdr1)) { //Test auf 0x27 7 Bit
25
    PORTB |= (1<<ERROR_LED);
26
    PORTB &= ~(1<<NORMAL_LED);
27
    while(1); //stop
28
  }else{
29
    PORTB |= (1<<NORMAL_LED);
30
    PORTB &= ~(1<<ERROR_LED);
31
  }
32
  
33
  while(1) {
34
    //Nothing
35
  }
36
  
37
}