All pastes #768721 Raw Edit

Anonymous

public c v1 · immutable
·published 2007-11-10 21:05 UTC
rendered paste body
#include <avr/io.h>#include <util/delay.h>#include <avr/interrupt.h>#define F_OSC 4000000//#define F_CPU 8000000void delay_ms(unsigned short ms) {        unsigned short outer1, outer2;        outer1 = 200;        while (outer1) {                outer2 = 1000;                while (outer2) {                        while ( ms ) ms--;                        outer2--;                }                outer1--;        }}int main(void){        unsigned short duration=5000;        //SET OUTPUT PINS        DDRD |= (1 << PD6);        DDRD |= (1 << PD5);        DDRD |= (1 << PD4);        while (1) {                PORTD |= (1 << PD6);                _delay_ms(duration);                PORTD &= ~(1 << PD6);                PORTD |= (1 << PD4);                _delay_ms(duration);                PORTD &= ~(1 << PD4);        }        return 0;}