Created
December 17, 2014 18:18
-
-
Save JDevlieghere/c0795d3933feb49c84c5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "contiki.h" | |
#include <stdio.h> | |
#include "adc.h" | |
PROCESS(hello_adc_process, "Hello ADC Process"); | |
AUTOSTART_PROCESSES(&hello_adc_process); | |
PROCESS_THREAD(hello_adc_process, ev, data) | |
{ | |
PROCESS_BEGIN(); | |
printf("Hello, world!\n"); | |
//Enable all external interupts | |
EIMSK = 0xff; | |
//Enable listening to all interupts (on rising edge) | |
EICRA = 0x03; | |
while(1) | |
{ | |
PROCESS_WAIT_EVENT(); | |
} | |
PROCESS_END(); | |
} | |
ISR(INT0_vect) | |
{ | |
int p = readADC(0); | |
printf("ADC=%d\n",p); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment