Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by kuba ( 6 years ago )
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "LCD_HD44780_IIC.h"
ISR(ADC_vect)
{
unsigned int a = ADC >> 2;
a *= a;
OCR0A = a >> 8;
}
int main(void)
{
int wartoscADC;
ADMUX = 0b01000011;
ADCSRA = 0b11101111;
DDRD |= 0b01000000;
TCCR0A |= 0b10000011;
TCCR0B |= 0b10000010;
sei();
char napis[4];
char data[24] = "Migajace diody";
LCDinit();
LCDhome();
LCDstring(data, 14);
while (1)
{
int dlugosc1;
wartoscADC = ADC;
if(wartoscADC<1000)
{
if(wartoscADC<100)
{
if(wartoscADC<10)
{
dlugosc1=1;
}
else dlugosc1=2;
}
else dlugosc1=3;
}
else dlugosc1=4;
itoa(wartoscADC, napis, 10);
LCDGotoXY(0,1);
LCDstring(napis, dlugosc1);
}
Revise this Paste