add 1.3
This commit is contained in:
@@ -7,12 +7,28 @@
|
|||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
void wait( int ms )
|
||||||
|
{
|
||||||
|
for (int i=0; i<ms; i++)
|
||||||
|
{
|
||||||
|
_delay_ms( 1 ); // library function (max 30 ms at 8MHz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
/* Replace with your application code */
|
DDRD = 0b11111111; // d is output
|
||||||
|
DDRC = 0b00000000; // c is all input
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
if (PINC & 0b00000001) {
|
||||||
|
|
||||||
|
PORTD = 0b01000000;
|
||||||
|
wait(1000);
|
||||||
|
PORTD = 0b00000000;
|
||||||
|
wait(1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user