Skip to content

Instantly share code, notes, and snippets.

@JDevlieghere
Created December 17, 2014 18:18
Show Gist options
  • Save JDevlieghere/c0795d3933feb49c84c5 to your computer and use it in GitHub Desktop.
Save JDevlieghere/c0795d3933feb49c84c5 to your computer and use it in GitHub Desktop.
#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