Hi folks,

I have tried to simulate a situation whereby when the ADC0 receives an
interrupt of 700 mV, the timer_rate will reduces to 6000 ms, while if
the ADC0 receives interrupt of less than 700 mV, the timer_rate will
back to its default value of 15000 ms.
This is implemented on the MicaZ side.

How can i direct the XmeshBase side, the base station to turn on the
Digital Port, D0 which is connected to a buzzer, to BEEP when the data
received is 700mV, and turn off when data received is less than 700
mV?

/*=========================================================*/
(LINE : 488) of XMDA300M.nc

switch (channelType) {
                case ANALOG:
                    switch (channel) {          
                        // MSG 1 : first part of analog channels (0-6)
                        case 0:
                tmppack=(XDataMsg *)packet.data;
                            tmppack->xData.datap6.adc0 =data ;
                                
                                if(data>700)
                                timer_rate = 6000; //2secs
                                call Timer.stop();
                                call Timer.start(TIMER_REPEAT, timer_rate);
                                
                                if(data<700)
                                timer_rate = 15000; //2secs
                                call Timer.stop();
                                call Timer.start(TIMER_REPEAT, timer_rate);
                                
                            atomic {msg_status|=0x01;}
                            break;

                        case 1:
                tmppack=(XDataMsg *)packet.data;
                            tmppack->xData.datap6.adc1 =data ;
                            atomic {msg_status|=0x02;}
                            break;

                        case 2:
                tmppack=(XDataMsg *)packet.data;
                            tmppack->xData.datap6.adc2 =data ;
                            atomic {msg_status|=0x04;}
                            break;



                        default:
                            break;
                    }  // case ANALOG (channel)
                    break;
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to