File: TemperatureTransmit.java

package info (click to toggle)
lcm 1.3.1%2Brepack1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,848 kB
  • sloc: ansic: 16,186; java: 6,843; cs: 2,266; cpp: 1,594; python: 989; makefile: 352; xml: 252; sh: 59
file content (25 lines) | stat: -rw-r--r-- 564 bytes parent folder | download | duplicates (5)
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
import lcm.lcm.*;

import lcmtypes.*;

public class TemperatureTransmit
{
    public static void main(String args[])
    {
        LCM myLCM = LCM.getSingleton();

        while (true)
	    {
            temperature_t temp = new temperature_t();
            temp.utime = System.nanoTime()/1000;
            temp.deg_celsius = 25.0 + 5*Math.sin(System.nanoTime()/1000000000.0);

            myLCM.publish("HALLWAY_TEMPERATURE", temp);

            try {
                Thread.sleep(10);
            } catch (InterruptedException ex) {
            }
	    }
    }
}