change to coap18
This commit is contained in:
parent
13aa2a1415
commit
fed6fe019c
16 changed files with 820 additions and 244 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Sample arduino sketch using contiki features.
|
||||
* We turn the LED off
|
||||
* We allow read the water sensor
|
||||
* We allow read the moisture sensor
|
||||
* Unfortunately sleeping for long times in loop() isn't currently
|
||||
* possible, something turns off the CPU (including PWM outputs) if a
|
||||
* Proto-Thread is taking too long. We need to find out how to sleep in
|
||||
|
@ -11,21 +11,24 @@
|
|||
*/
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
#include "resource_pir.h"
|
||||
#include "rest-engine.h"
|
||||
|
||||
extern resource_t res_room, res_battery;
|
||||
uint8_t room_pin = 3;
|
||||
uint8_t room_status = 0;
|
||||
|
||||
#define LED_PIN 4
|
||||
|
||||
uint8_t pir_pin = A5;
|
||||
uint16_t pir_value = 0;
|
||||
}
|
||||
|
||||
void setup (void)
|
||||
{
|
||||
// switch off the led
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
digitalWrite(LED_PIN, HIGH);
|
||||
// init coap resourcen
|
||||
rest_init_engine ();
|
||||
rest_activate_resource (&resource_pir);
|
||||
rest_activate_resource (&res_room, "s/room");
|
||||
rest_activate_resource (&res_battery, "s/battery");
|
||||
}
|
||||
|
||||
void loop (void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue