2017-03-24 20:10:37 +01:00
|
|
|
/*
|
|
|
|
* Gardena 9V Magnet-Valve
|
|
|
|
* We have a CoAP Resource for the Valve, it can be in state 1 (on) and
|
|
|
|
* 0 (off).
|
|
|
|
* Transition on-off outputs a negative pulse
|
|
|
|
* Transition off-on outputs a positive pulse
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "valve.h"
|
|
|
|
}
|
|
|
|
|
|
|
|
void setup (void)
|
|
|
|
{
|
|
|
|
arduino_pwm_timer_init ();
|
|
|
|
digitalWrite (ENABLE_PIN, LOW);
|
|
|
|
digitalWrite (BRIDGE1_PIN, LOW);
|
|
|
|
digitalWrite (BRIDGE2_PIN, LOW);
|
|
|
|
pinMode (ENABLE_PIN, OUTPUT);
|
|
|
|
pinMode (BRIDGE1_PIN, OUTPUT);
|
|
|
|
pinMode (BRIDGE2_PIN, OUTPUT);
|
|
|
|
digitalWrite (ENABLE_PIN, LOW);
|
|
|
|
digitalWrite (BRIDGE1_PIN, LOW);
|
|
|
|
digitalWrite (BRIDGE2_PIN, LOW);
|
|
|
|
|
|
|
|
rest_init_engine ();
|
2017-08-20 15:01:30 +02:00
|
|
|
rest_activate_resource (&res_valve, (char *)"valve");
|
2017-03-24 20:10:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop (void)
|
|
|
|
{
|
|
|
|
printf ("valve : %u\n", valve);
|
|
|
|
}
|