summaryrefslogtreecommitdiffstats
path: root/userland/radiator.c
blob: 2d594da58890e242e65480f931445941a1d821a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#include "radiator.h"

int
main (int argc, char *argv[])
{
  Radiator *r;
  int pos;
  char buf[1024];


  r = radiator_open (argv[1],0);

  if (!r)
    return -1;


  for (;;)
    {
      printf ("Current position %d (end stop at %d, overshoots by %d)\n",
              r->pos, r->max, r->overshoot);
      printf ("Enter new>");
      fflush (stdout);
      buf[sizeof (buf) - 1] = 0;
      fgets (buf, sizeof (buf) - 1, stdin);
      radiator_set_pos (r, atoi (buf));
    }


  return 0;
}