全文预览

TinyOS操作系统开发技术及实践课件实践5TinyOS网络协议

上传者:科技星球 |  格式:ppt  |  页数:39 |  大小:1121KB

文档介绍
ensor;}实践5 TinyOS网络协议8(2) SmokeTestSC.nc文件中的主要代码实现如下:#include <Timer.h>#include "Adc.h"#include "BlinkToRadio.h"module SmokeTestSC{uses{interface AMSend;interface Packet;interface AMPacket;interface Read<int16_t> as ADSensorRead;interface ontrol as ADSensorControl;interface Boot;实践5 TinyOS网络协议9interface SplitControl as RadioControl;interface StdControl as DisseminationControl;interface DisseminationValue<uint16_t> as Value16;interface DisseminationUpdate<uint16_t> as Update16;interface Leds;interface Timer<TMilli>;}}implementation {uint16_t counter;am_addr_t DES = 0x0003;实践5 TinyOS网络协议10/*传感器采集任务*/task void sensorTask(){//选择P0.7为AD采集通道,call ADSensorControl.enable(ADC_REF_AVDD, ADC_14_BIT, ADC_AIN3);//开始采集AD信息call ADSensorRead.read();}event void Boot.booted() {call RadioControl.start();}

收藏

分享

举报
下载此文档