commit 53214d921242c3d0162603a557b0485a2a5121df Author: pjht Date: Mon Jan 8 19:13:54 2018 -0600 Initial commit diff --git a/Blink/iostuff.h b/Blink/iostuff.h new file mode 100644 index 0000000..39b278f --- /dev/null +++ b/Blink/iostuff.h @@ -0,0 +1,9 @@ +#define B0 (1<<0) +#define B1 (1<<1) +#define B2 (1<<2) +#define B3 (1<<3) +#define B4 (1<<4) +#define B5 (1<<5) +#define B6 (1<<6) +#define B7 (1<<7) +#define biton(port,bit) ((port & bit) != 0) diff --git a/Blink/main.c b/Blink/main.c new file mode 100644 index 0000000..b9b1719 --- /dev/null +++ b/Blink/main.c @@ -0,0 +1,13 @@ +#include +#include +#include "iostuff.h" +int main() { + DDRB=B5; // Set pin 13 as an output + for(;;) { + PORTB|=B5; // Make pin 13 HIGH + _delay_ms(500); // Wait half a second + PORTB&=~B5; // Make pin 13 LOW + _delay_ms(500); // Wait half a second + } + return 0; +} diff --git a/LProbe/iostuff.h b/LProbe/iostuff.h new file mode 100644 index 0000000..39b278f --- /dev/null +++ b/LProbe/iostuff.h @@ -0,0 +1,9 @@ +#define B0 (1<<0) +#define B1 (1<<1) +#define B2 (1<<2) +#define B3 (1<<3) +#define B4 (1<<4) +#define B5 (1<<5) +#define B6 (1<<6) +#define B7 (1<<7) +#define biton(port,bit) ((port & bit) != 0) diff --git a/LProbe/main.c b/LProbe/main.c new file mode 100644 index 0000000..5495943 --- /dev/null +++ b/LProbe/main.c @@ -0,0 +1,15 @@ +#include +#include "iostuff.h" + +int main() { + DDRB=B4|B5; // Set pins 12 and 13 as outputs + DDRD=~B2; // Set pin 2 as an input + for(;;) { + if (biton(PIND,B2)) { // If pin 2 is high + PORTB=B5; // Make pin 13 HIGH + } else { // Otherwise (if low) + PORTB=B4; // Make pin 12 HIGH + } + } + return 0; +} diff --git a/NLight/iostuff.h b/NLight/iostuff.h new file mode 100644 index 0000000..39b278f --- /dev/null +++ b/NLight/iostuff.h @@ -0,0 +1,9 @@ +#define B0 (1<<0) +#define B1 (1<<1) +#define B2 (1<<2) +#define B3 (1<<3) +#define B4 (1<<4) +#define B5 (1<<5) +#define B6 (1<<6) +#define B7 (1<<7) +#define biton(port,bit) ((port & bit) != 0) diff --git a/NLight/main.c b/NLight/main.c new file mode 100644 index 0000000..8fb1883 --- /dev/null +++ b/NLight/main.c @@ -0,0 +1,16 @@ +#include +#include +#include "iostuff.h" + +int main() { + DDRD=~B4; + DDRB=B5; + for(;;) { + if (biton(PIND,B4)) { + PORTB&=~B5; + } else { + PORTB|=B5; + } + } + return 0; +} diff --git a/Template/iostuff.h b/Template/iostuff.h new file mode 100644 index 0000000..39b278f --- /dev/null +++ b/Template/iostuff.h @@ -0,0 +1,9 @@ +#define B0 (1<<0) +#define B1 (1<<1) +#define B2 (1<<2) +#define B3 (1<<3) +#define B4 (1<<4) +#define B5 (1<<5) +#define B6 (1<<6) +#define B7 (1<<7) +#define biton(port,bit) ((port & bit) != 0) diff --git a/Template/main.c b/Template/main.c new file mode 100644 index 0000000..104b6fe --- /dev/null +++ b/Template/main.c @@ -0,0 +1,10 @@ +#include +#include +#include "iostuff.h" + +int main() { + + for(;;) { + } + return 0; +}