' **********************************************************************
' * Script name:   IOADC                                               *
' * Description:   The device sends message to the serial port when    *
' *                the ADC1 is between 512 and 1023 (High) or send the *
' *                to the serial port when the ADC1 is between 0 and   *
' *                511 (low)                                           *
' * Responsible:   Kockritz, Pete                                      *
' * Date:          02/23/2011                                          *
' **********************************************************************
' --------------------------------------------------------------------
' General configuration
' --------------------------------------------------------------------
AT&F
AT+GSN
AT$PKG?
AT$MDMID?
at+cgatt=0
at+cgdcont=1,"IP","internet3.voicestream.com"
at$friend=1,1,"209.42.60.137", 1720
at$udpapi=,1720

'trigger on ADC1 between 512 and 1023, execute stored cmd 1
at$event=10,0,18,512,1023
at$event=10,3,44,1,0
at$stoatev=1,at$msgsnd=0,"IOADC 1 high"

' trigger on ADC1 between 0 and 511, execute stored cmd 2
at$event=20,0,18,0,511
at$event=20,3,44,2,0
at$stoatev=2,at$msgsnd=0,"IOADC 1 low"

'trigger on ADC2 between 512 and 1023, execute stored cmd 1
at$event=30,0,19,512,1023
at$event=30,3,44,3,0
at$stoatev=3,at$msgsnd=0,"IOADC 2 high"

' trigger on ADC2 between 0 and 511, execute stored cmd 2
at$event=40,0,19,0,511
at$event=40,3,44,4,0
at$stoatev=4,at$msgsnd=0,"IOADC 2 low"

at+cgatt=1
at$areg=2
at&w
