Skip to content

Instantly share code, notes, and snippets.

@slintak
Forked from jiriw/jiriho
Last active August 29, 2015 13:56
Show Gist options
  • Save slintak/9238762 to your computer and use it in GitHub Desktop.
Save slintak/9238762 to your computer and use it in GitHub Desktop.
// blik.h**********************************************************************************
#ifndef BLIK_H_INCLUDED
#define BLIK_H_INCLUDED
#include <stdint.h>
extern void blik(void);
void morse (uint8_t i);
#endif // BLIK_H_INCLUDED
// main.c**********************************************************************************
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>
#include "blik.h"
#include <stdint.h> //pro standartizovane typy
int main (void)
{
DDRG |= _BV(PG1); //LED9 pro blik
DDRG |= _BV(PG0); //LED10 pro SOS
uint8_t pole[] = { 1,0,1,0,1,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,0,1,0,1 };
uint8_t i = 0
while (1){
morse(pole[i]);
i++;
// Vyresit preteceni
//_delay_ms(200);
}
}
//blik.c**********************************************************************************
#include "blik.h"
#include <avr/io.h>
#include <stdio.h>
#include <stdint.h> //pro standartizovane typy
void morse (uint8_t i){
if (i) { //roznuti
PORTG |= 0b00000010;
}
else { //zhasnuti
PORTG &= 0b11111101;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment