View difference between Paste ID: dU7z5bRF and n0VXDZZy
SHOW: | | - or go back to the newest paste.
1
//funkcija
2
void pinstate(uint8_t port, uint8_t pin, uint8_t state) {	
3
	if (state == 0) {
4
		port &= ~(1 << pin);
5
	} else {
6
		port |= (1 << pin);
7
	}
8
}
9
10
//Uporaba
11
pinstate(PORTB, PINB0, 1);
12
13
//ProgramĨek, kjer NE dela (brez headerja)
14
15
void pinstate(uint8_t port, uint8_t pin, uint8_t state) {	
16
	if (state == 0) {
17
		port &= ~(1 << pin);
18-
	DDRB = 0xFF; //dela
18+
19
		port |= (1 << pin);
20-
		pinstate(PORTB, PINB0, 1); //ne dela
20+
21
}
22
23-
		pinstate(PORTB, PINB0, 0); //ne dela
23+
24
	uart_init(9600);
25
	uart_putsln("haj");
26
	pinstate(DDRB, PINB0, 1); //ne dela
27
	DDRB = 0xFF;
28
    	while (1) {
29
		pinstate(&PORTB, PINB0, 1); //ne dela
30
		//PORTB |= 1 << PINB0; //dela
31
		_delay_ms(200);
32
		pinstate(&PORTB, PINB0, 0); //ne dela
33
		//PORTB &= ~(1 << PINB0); // dela
34
		_delay_ms(200);
35
    	}
36
}