29.08.2013 Views

Autonom robotväckarklocka med trådlös basstation - KTH

Autonom robotväckarklocka med trådlös basstation - KTH

Autonom robotväckarklocka med trådlös basstation - KTH

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

akåt<br />

}<br />

}<br />

ut=2; //kommando för att köra<br />

hastighet=8;<br />

steg=800;<br />

motorDriv(ut, steg, hastighet);<br />

int motorDriv(int ut, double steg, int hastighet){<br />

}<br />

int stepMade = 0;<br />

int stepBefore = -1;<br />

OCR0=hastighet; //Flagga för timer0<br />

OCR2=hastighet; //Flagga för timer2<br />

if (ut == 1){ //Frammåt<br />

motsatt0 = 0;<br />

motsatt2 = 0;<br />

}else if (ut == 2){ //Bakåt<br />

motsatt0 = 1;<br />

motsatt2 = 1;<br />

}else if (ut == 3){ //Vänster<br />

motsatt0 = 0;<br />

motsatt2 = 1;<br />

}else if (ut == 4){ //Höger<br />

motsatt0 = 1;<br />

motsatt2 = 0;<br />

}<br />

TIMSK&=~0xC2;<br />

TIMSK|=0xC2;<br />

while(stepMade

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!