1 / 12

HelloWorld

HelloWorld. By using LED & Timer components, we will display “helloworld” in a manner of Morse code. Morse Code & LED. Morse Code. Morse code Using Dot and dash, 3 dots distance for distinguish character and symbol Following table shows morse code for alphabet. HelloWorld Example.

bernad
Download Presentation

HelloWorld

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. HelloWorld By using LED & Timer components, we will display “helloworld” in a manner of Morse code.

  2. Morse Code &LED

  3. Morse Code • Morse code • Using Dot and dash, 3 dots distance for distinguish character and symbol • Following table shows morse code for alphabet

  4. HelloWorld Example

  5. HelloWorld Example • HelloWorld source location • c:\Programfiles\UCB\cygwin\opt\tinyos‐1.x\contrib\zigbex\ helloworld • HelloWorld.nc &HelloWorldM.nc

  6. HelloWorld.nc • HelloWorld.nc • Configuration file configuration HelloWorld { } implementation { components Main, HelloWorldM, TimerC, LedsC; Main.StdControl ‐> HelloWorldM; Main.StdControl ‐> TimerC; HelloWorldM.Timer ‐> TimerC.Timer[unique("Timer") ]; HelloWorldM.Leds ‐> LedsC; }

  7. HelloWorldM.nc • HelloWorldM.nc (1) module HelloWorldM { provides { interface StdControl; } uses { interface Timer; interface Leds; } } implementation { command result_t StdControl.init() { call Leds.init(); call Leds.redOff(); call Leds.yellowOff(); call Leds.greenOff(); return SUCCESS; } command result_t StdControl.start() { return call Timer.start(…); }

  8. HelloWorldM.nc • HelloWorldM.nc (2) command result_t StdControl.stop() { return call Timer.stop(); } event result_t Timer.fired() { static char *morse = ".... . .‐.. .‐.. ‐‐‐ ‐‐..‐‐ " ".‐‐ ‐‐‐ .‐. .‐.. ‐.. "; static char *current; if( !current ) current = morse; switch( *current ) { case ' ': /* pause: off for two units */ call Timer.start(TIMER_ONE_SHOT, 2 * MORSE_UNIT); current++; break; case '.': /* dot: on for one unit, off for one unit */ … if( !*current ) current = morse; return SUCCESS; } }

  9. HelloWorld Lab

  10. HelloWorld lab. 1 • Cygwin starts and move directory as follows: • make zigbex cd /opt/tinyos‐1.x/contrib/zigbex cd helloworld

  11. HelloWorld lab. 2 • ZigbeX Download • Run AVR studio at Windows • Tolol->auto connect-> browse main.hex located at • c:\Programfiles\UCB\cygwin\opt\tinyos‐1.x\contrib\zigbex\HelloWorld\ build\zigbex

  12. HelloWorld result • result • Check the LED

More Related