Added examples.

This commit is contained in:
Marvin Blum
2017-04-01 02:18:44 +02:00
parent 6074be0eff
commit bbb7d6faba
4 changed files with 120 additions and 30 deletions

39
ard/example/digital.c Normal file
View File

@@ -0,0 +1,39 @@
#include <util/delay.h>
#include <stdio.h>
#include "ard/serial.h"
#include "ard/pins.h"
#include "ard/util.h"
void prepare();
void loop();
int main(){
prepare();
while(1){
loop();
}
}
void prepare(){
// enable global interrupts and serial port
pins_init();
serial_init(9600);
pin_mode(11, OUTPUT);
pin_mode(10, INPUT);
pin_mode(8, INPUT);
}
unsigned char pwm = 0;
void loop(){
if(digital_read(10) && digital_read(8)){
digital_write(11, HIGH);
}
else{
digital_write(11, LOW);
}
_delay_ms(25);
}