summaryrefslogtreecommitdiffstats
path: root/door_lock
diff options
context:
space:
mode:
Diffstat (limited to 'door_lock')
-rw-r--r--door_lock/main.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/door_lock/main.c b/door_lock/main.c
index 178538c..fb2b449 100644
--- a/door_lock/main.c
+++ b/door_lock/main.c
@@ -3,22 +3,28 @@
#include "serial.h"
+#define PWM_MIN 1200
+#define PWM_MID 3000
+#define PWM_MAX 5000
+
int main(void) {
// pin 9
DDRB |= 1 << PINB1;
TCCR1A |= (1 << WGM11) | (1 << COM1A1);
TCCR1B |= (1 << WGM12) | (1 << WGM13) | (1 << CS11);
- ICR1 = 39999;
- int offset = 800;
+ ICR1 = 40000;
serial_init();
for(;;) {
- OCR1A = 3999 + offset;
+ OCR1A = PWM_MID;
_delay_ms(5000);
-
- OCR1A = 1999 - offset;
+ OCR1A = PWM_MIN;
+ _delay_ms(5000);
+ OCR1A = PWM_MID;
+ _delay_ms(5000);
+ OCR1A = PWM_MAX;
_delay_ms(5000);
serial_write_line("hello, world!");