[Tinyos-2-commits] CVS: tinyos-2.x/apps/MultihopOscilloscope oscilloscope.py, NONE, 1.1

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Sun Dec 14 16:50:39 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/apps/MultihopOscilloscope
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23246/apps/MultihopOscilloscope

Added Files:
	oscilloscope.py 
Log Message:
Improvements to tos.py. 

This latest version includes:
  * support for MIB600
  * a generic dump program (tos-dump) that has support for decoding the
    printf packets
  * a few example programs for some of the applications (Oscilloscope,
    MultihopOscilloscope, TestFtsp, TestLocalTime).



--- NEW FILE: oscilloscope.py ---
#!/usr/bin/env python

import sys
import tos

AM_OSCILLOSCOPE = 0x93

class OscilloscopeMsg(tos.Packet):
    def __init__(self, packet = None):
        tos.Packet.__init__(self,
                            [('version',  'int', 2),
                             ('interval', 'int', 2),
                             ('id',       'int', 2),
                             ('count',    'int', 2),
                             ('readings', 'blob', None)],
                            packet)

if '-h' in sys.argv:
    print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600"
    sys.exit()

am = tos.AM()

while True:
    p = am.read()
    if p and p.type == AM_OSCILLOSCOPE:
        msg = OscilloscopeMsg(p.data)
        print msg.id, msg.count, [i<<8 | j for (i,j) in zip(msg.readings[::2], msg.readings[1::2])]
        #print msg




More information about the Tinyos-2-commits mailing list