Initial commit

This commit is contained in:
pjht 2018-01-08 19:13:54 -06:00
commit 53214d9212
8 changed files with 90 additions and 0 deletions

9
Blink/iostuff.h Normal file
View File

@ -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)

13
Blink/main.c Normal file
View File

@ -0,0 +1,13 @@
#include <avr/io.h>
#include <util/delay.h>
#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;
}

9
LProbe/iostuff.h Normal file
View File

@ -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)

15
LProbe/main.c Normal file
View File

@ -0,0 +1,15 @@
#include <avr/io.h>
#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;
}

9
NLight/iostuff.h Normal file
View File

@ -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)

16
NLight/main.c Normal file
View File

@ -0,0 +1,16 @@
#include <avr/io.h>
#include <util/delay.h>
#include "iostuff.h"
int main() {
DDRD=~B4;
DDRB=B5;
for(;;) {
if (biton(PIND,B4)) {
PORTB&=~B5;
} else {
PORTB|=B5;
}
}
return 0;
}

9
Template/iostuff.h Normal file
View File

@ -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)

10
Template/main.c Normal file
View File

@ -0,0 +1,10 @@
#include <avr/io.h>
#include <util/delay.h>
#include "iostuff.h"
int main() {
for(;;) {
}
return 0;
}