1 / 18

Lab1: LED Control

Learn how to control Red, Yellow, and Green LEDs using ZigbeX in this lab. Utilize the LedsC component and Blink program to check device operations. Understand LED control components using TinyOS.

tpaula
Download Presentation

Lab1: LED Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lab1: LED Control ZigbeX mote has Red, Yellow, Green LED. This lab using LED control component provided by TinyOS exercises LED device control.

  2. ZigbeX LED

  3. LED in ZigbeX • Use of LED • In order to check whether certain device’s operation is performed successfully or not. • LedsC Component • LedsC is component to control the LED device.

  4. Leds functions

  5. LED sample progam

  6. Blink program • Blink program • An instant component named “Blink”. Forconfiguration andmodule,two files Blink.nc &BlinkM.nc are required. • Blink.nc is for configuration which uses many other componentsused in Blink program • BlinkM.nc is a implemented module for Blink program. • Directory of Blink program • c:\Programfiles\UCB\cygwin\opt\tinyos‐1.x\contrib\zigbex\Blink\ • Bink.nc &BlinkM.nc

  7. Blink.nc • Blink.nc . • Main, LedSc, BlinkM are used and shows how they are wired. configuration Blink { } implementation { components Main, BlinkM, LedsC; Main.StdControl ‐> BlinkM.StdControl; BlinkM.Leds ‐> LedsC; }

  8. BlinkM.nc • BlinkM.nc (1) module BlinkM { provides { interface StdControl; } uses { interface Leds; } } implementation { task void led_task(); command result_t StdControl.init() { call Leds.init(); return SUCCESS; } • - declared by “provide” interfaceand • “uses” interface • In implementation block is for user programming • task (function w/o parameter) : declaration • StdControlinit(), start(), stop() sequence. • - StdControl.init() calls Leds.init() • to initialize LedsC.

  9. BlinkM.nc • BlinkM.nc (2) command result_t StdControl.start() { post led_task(); return SUCCESS; } command result_t StdControl.stop() { return SUCCESS; } task void led_task() { int i; for(i=0; i<10; i++) { call Leds.yellowOn(); TOSH_uwait(30000); call Leds.greenToggle(); } } } • After StdControl.init(), StdControl.start() is • executed automatically • In StdControl.start(), defined by “task” • led_task() is called by “post” header. • - No specific implemetation in StdControl.stop(). • - Here your algorithm to control LED

  10. LED Lab Item: host PC(labtop), 1 mote , ISP(AVR), cable

  11. LED lab -1 • Start cygwin • Goto target directory • Compile - make zigbex cd /opt/tinyos‐1.x/contrib/zigbex cd Blink

  12. LED lab -2 • Download binary code to ZigbeX using ISP tool • After compile, folder, build/zigbex is created and main.hex is the binary. • Run AVR studio

  13. Lab -3 • Run AVR Studio4 • Select ‘cancel’

  14. Lab -4 • Select • Tool  Program AVRAuto Connect

  15. Lab -5 • Find ‘main.hex’ file

  16. Lab - 6 • Select ‘Program’

  17. Lab - 5 • Check the message and graph

  18. LED lab result • Output • Yellow LEDis con, every 30msGreen LEDis toggling • Please change source code to test RED.

More Related