SlideShare a Scribd company logo
TINYOS
CREATING APPLICATIONS FOR WIRELESS SENSORS
M.Tech Part I 1st Semester
University of kalyani
5/31/2018 Riman Mandal, mandal.riman@gmail.com 1
Overview
Sensor code
(nesC/TinyOS)
Base station code
(nesC/TinyOS)
Gateway code
(Java, c, …)
Serial/USB
Wireless
Communication
iris/sensor
5/31/2018 Riman Mandal, mandal.riman@gmail.com 2
Required Hardwares
■ Programming Board
■ Mote
■ Sensing Board
■ And a PC of course….
A Typical Mote
5/31/2018 Riman Mandal, mandal.riman@gmail.com 3
Typical Programming Board
For Practical Purpose We have a different model
5/31/2018 Riman Mandal, mandal.riman@gmail.com 4
Typical Sensor Board
For Practical Purpose We have a different model
5/31/2018 Riman Mandal, mandal.riman@gmail.com 5
Typical Mote
Antenna Interface
Power Button
2 AA battery
Section
For Practical Purpose We have a different model
5/31/2018 Riman Mandal, mandal.riman@gmail.com 6
Tiny OS
■ An operating system for low power, embedded,
wireless devices
– Wireless sensor networks (WSNs)
– Sensor-actuator networks
– Embedded robotics
■ Open source, open developer community
■ http://www.tinyos.net
■ E-book: TinyOS Programming:
http://csl.stanford.edu/~pal/pubs/tinyos-
programming.pdf
5/31/2018 Riman Mandal, mandal.riman@gmail.com 7
Tiny OS (Cont.)
■ An open-source development environment
■ Not an operation system for general purpose, it
is designed for wireless embedded sensor
network.
■ Programming language: NesC (an extension of C)
■ It features a component-based architecture.
■ Supported platforms include Linux, Windows
2000/XP with Cygwin.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 8
Installation
■ Need Ubuntu 12.04 LTS for hassle free installation.
■ Try installing TinyOS ON Windows machines using VMWare
or Virtual Box.
■ I will send the details of Installation via e-mail.
■ If you are interested we can try on Windows using
Cygwin.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 9
Installing TinyOS 2.1.2
on Ubuntu 12.04 LTS
using Virtual Box
5/31/2018 Riman Mandal, mandal.riman@gmail.com 10
Preprocessing
■ Install VirtualBox on your Windows machine.
■ Install Ubuntu 12.04LTS inside the Virtual Machine.
■ Start the Ubuntu from Virtual machine.
■ Open Ubuntu Terminal.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 11
Step 1 Adding TinyOS
Source
■ Execute the following command,
■ Paste the line given below at the end of the file
■ Save the file and quit
5/31/2018 Riman Mandal, mandal.riman@gmail.com 12
sudo gedit /etc/apt/sources.list
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu
lucid main
Step 2 Installing TinyOS
■ First update the TinyOS source using.
■ Use the following command to install TinyOS on your
Ubuntu machine.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 13
sudo apt-get update
sudo apt-get install tinyos2.1.2
Step 3 Environment Setup
■ Enter the following command to edit the Environment
setup in Ubuntu
■ Add the following line at the end of the ~/.bashrc file.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 14
sudo gedit ~/.bashrc
#Sourcing the tinyos environment variable setup script
source /opt/tinyos-2.1.2/tinyos.sh
export CLASSPATH=$CLASSPATH:.
Step 4 Creating the
Environment Source File
■ Create the setup script file using the command
■ Now enter the following contents into this file
5/31/2018 Riman Mandal, mandal.riman@gmail.com 15
sudo gedit /opt/tinyos-2.1.2/tinyos.sh
#echo "Setting up for TinyOS 2.1.2"
export TOSROOT=
export TOSDIR=
export MAKERULES=
TOSROOT="/opt/tinyos-2.1.2"
TOSDIR="$TOSROOT/tos"
CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:$TOSROOT/support/sdk
/java/tinyos.jar
MAKERULES="$TOSROOT/support/make/Makerules"
export TOSROOT
export TOSDIR
export CLASSPATH
export MAKERULES
Step 5 Permission for Setup
Script and Refresh
Environment
■ Run the command below to allow this script to execute
■ To refresh the environment with new setup - close and
start a new terminal or alternatively execute the
following command
5/31/2018 Riman Mandal, mandal.riman@gmail.com 16
sudo chmod 755 /opt/tinyos-2.1.2/tinyos.sh
source ~/.bashrc
Checking if Installation is
successful
■ Run the command to check TOS environment setup is
complete or not
■ If it gives warnings related to Java version then do
■ If your version is above 1.5, then ignore this warning else
upgrade to a newer java version. Ignore
the warning related to graphviz.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 17
tos-check-env
java -version
TinyOS Programming
5/31/2018 Riman Mandal, mandal.riman@gmail.com 18
Basic Idea
■ HURRY UP AND SLEEP!!
– Sleep as often as possible to save power
■ Programs are built out of components
– Libraries and components are written in nesC.
– Applications are too -- just additional components
composed with the OS components.
■ Each component is specified by an interface
– Provides “hooks” for wiring components together
■ Components are statically wired together based on their
interfaces
– Increases runtime efficiency
5/31/2018 Riman Mandal, mandal.riman@gmail.com 19
Basic Unit of Programming
■ Basic unit of nesC code is a component
■ Components connect via interfaces
– Connections called “wiring”
5/31/2018 Riman Mandal, mandal.riman@gmail.com 20
B
A
interface
What is a Component?
■ A component is a file (names must match)
■ Modules are components that have variables and
executable code
■ Configurations are components that wires other
components together
■ A component does not care if another component is a
module or configuration
■ A component may be composed of other components via
configurations
5/31/2018 Riman Mandal, mandal.riman@gmail.com 21
Component Example
5/31/2018 Riman Mandal, mandal.riman@gmail.com 22
TimerC
BlinkC
Timer
module BlinkC {
uses interface Timer<TMilli>
as Timer0
provide interface xxxx}
implementation {
int c;
void increment() {c++;}
event void Timer0.fired()
{
call Leds.led0Toggle();
}
}
configuration BlinkAppC
{
}
implementation
{
components MainC, BlinkC, LedsC;
components new TimerMilliC()
as Timer0;
BlinkC.Timer0 -> Timer0;
BlinkC -> MainC.Boot;
BlinkC.Leds -> LedsC;
}
Singletons and Generics
5/31/2018 Riman Mandal, mandal.riman@gmail.com 23
■ Singleton components are unique: they exist in a global
namespace
■ Generics are instantiated: each instantiation is a new,
independent copy
configuration BlinkC { … }
implementation {
components new TimerC();
components BlinkC;
BlinkC.Timer -> TimerC;
}
Component Syntax - Module
5/31/2018 Riman Mandal, mandal.riman@gmail.com 24
■ A component specifies a set of interfaces by which it is connected to
other components
– provides a set of interfaces to others
– uses a set of interfaces provided by others
module ForwarderM {
provides {
interface StdControl;
}
uses {
interface StdControl as CommControl;
interface ReceiveMsg;
interface SendMsg;
interface Leds;
}
}
implementation {
…// code implementing all provided commands
and used events
}
ForwarderM
StdControl ReceiveMsg
provides uses
CommControl
SendMsg
Leds
Component Syntax -
Configuration
5/31/2018 Riman Mandal, mandal.riman@gmail.com 25
configuration Forwarder { }
implementation
{
components Main, LedsC;
components GenericComm as Comm;
components ForwarderM;
Main.StdControl -> ForwarderM.StdControl;
ForwarderM.CommControl -> Comm;
ForwarderM.SendMsg -> Comm.SendMsg[AM_INTMSG];
ForwarderM.ReceiveMsg -> Comm.ReceiveMsg[AM_INTMSG];
ForwarderM.Leds -> LedsC;
}
Component
Selection
Wiring the
Components
together
ForwarderM
StdControl ReceiveMsg
provides uses
CommControl
SendMsg
Leds
Main StdControl
LedsC
Leds
GenericComm
SendMsg
ReceiveMsg
StdControl
Forwarder
Interface
5/31/2018 Riman Mandal, mandal.riman@gmail.com 26
■ Collections of related functions
■ Define how components connect
■ Interfaces are bi-directional: for A->B
– Commands are from A to B
– Events are from B to A
■ Can have parameters (types)
interface Timer<tag> {
command void startOneShot(uint32_t period);
command void startPeriodic(uint32_t period);
event void fired();
}
Interface (provide and use)
5/31/2018 Riman Mandal, mandal.riman@gmail.com 27
User
Provider
Interface
Commands
Events
Module BlinkC {
use interface xxxx;
provide interface xxxxxxx;
.........
}
Interface (provide and use)
(Cont.)
■ A component provides and uses interfaces.
■ A interface defines a logically related set of commands
and events.
■ Components implement the events they use and the
commands they provide:
5/31/2018 Riman Mandal, mandal.riman@gmail.com 28
Component Commands Events
Use Can call Must implement
Provide Must implement Can signal
Terminal Commands related
to TinyOS
■ system modifications
– sudo chmod –R 777 /bin
– sudo chmod –R 777 /dev
■ applications directory
– /opt/tinyos-2.1.1/apps/
■ making hex image for iris mote without sensor board
– make iris
■ making hex image for iris mote with sensor board
– SENSORBOARD=mda100 make iris
■ burning hex image into iris mote
– make <mote> install.moteid burnerid,/dev/tty<serialport>
– EX. make iris install.0 mib520,/dev/ttyUSB0
– EX. make iris reinstall.0 mib520,/dev/ttyUSB0
■ burning hex image into iris mote with sensor board
■ SENSORBOARD=mda100 make iris reinstall.0 mib520,/dev/ttyUSB0
5/31/2018 Riman Mandal, mandal.riman@gmail.com 29
Power Up Testing
Programing
■ Try to build a tinyOS app that turn on the Red Led on
Power up.
5/31/2018 Riman Mandal, mandal.riman@gmail.com 30
PowerUpC
uses
Boot
Leds
MainC
Boot
LedsC
Leds
Code
5/31/2018 Riman Mandal, mandal.riman@gmail.com 31
configuration PowerupAppC{}
implementation {
components MainC, PowerupC, LedsC;
MainC.Boot <- PowerupC.Boot;
PowerupC.Leds -> LedsC.Leds;
}
module PowerupC @safe()
{
uses interface Boot;
uses interface Leds;
}
implementation
{
event void Boot.booted() {
call Leds.led0On();
}
}
Blink App Using
Timer<TMilli> C
■ The Red light will blink continuously with a time interval
5/31/2018 Riman Mandal, mandal.riman@gmail.com 32
BlinkC
uses
Boot
Leds
MainC
Boot
LedsC
Using Printf Component
■ Include printf.h header file in the module file
■ Use Printf method to print anything on terminal
■ Add Component PrintfC in the Component File
■ Use the following command to print on the terminal
– java net.tinyos.tools.PrintfClient -comm
serial@/dev/ttyUSB1:iris
5/31/2018 Riman Mandal, mandal.riman@gmail.com 33
java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX:telosb

More Related Content

What's hot

Embedded Systems (18EC62) – Embedded System Components (Module 3)
Embedded Systems (18EC62) – Embedded System Components (Module 3)Embedded Systems (18EC62) – Embedded System Components (Module 3)
Embedded Systems (18EC62) – Embedded System Components (Module 3)
Shrishail Bhat
 
Node level simulators
Node level simulatorsNode level simulators
Node level simulators
SyedAhamed44
 
Microcontrollers 8051 MSP430 notes
Microcontrollers 8051 MSP430 notesMicrocontrollers 8051 MSP430 notes
Microcontrollers 8051 MSP430 notes
Niteesh Shanbog
 
Schedule Based MAC Protocol
Schedule Based MAC ProtocolSchedule Based MAC Protocol
Schedule Based MAC Protocol
Darwin Nesakumar
 
Vx works RTOS
Vx works RTOSVx works RTOS
Vx works RTOS
Sai Malleswar
 
Vxworks
VxworksVxworks
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded SystemsSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
Arti Parab Academics
 
IT8602 Mobile Communication Question Bank
IT8602 Mobile Communication Question BankIT8602 Mobile Communication Question Bank
IT8602 Mobile Communication Question Bank
pkaviya
 
CDMA
CDMACDMA
SoC FPGA Technology
SoC FPGA TechnologySoC FPGA Technology
SoC FPGA Technology
Siraj Muhammad
 
Embedded system Design
Embedded system DesignEmbedded system Design
Embedded system Design
AJAL A J
 
Typical Embedded System
Typical Embedded SystemTypical Embedded System
Typical Embedded System
anand hd
 
Unit1
Unit1Unit1
Embedded System Basics
Embedded System BasicsEmbedded System Basics
Embedded System Basics
Dr M Muruganandam Masilamani
 
Timer And Counter in 8051 Microcontroller
Timer And Counter in 8051 MicrocontrollerTimer And Counter in 8051 Microcontroller
Timer And Counter in 8051 Microcontroller
Jay Makwana
 
Traffic-adaptive Medium Access Protocol
Traffic-adaptive Medium Access ProtocolTraffic-adaptive Medium Access Protocol
Traffic-adaptive Medium Access Protocol
Gaurav Chauhan
 
Sensor Protocols for Information via Negotiation (SPIN)
Sensor Protocols for Information via Negotiation (SPIN)Sensor Protocols for Information via Negotiation (SPIN)
Sensor Protocols for Information via Negotiation (SPIN)rajivagarwal23dei
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC Tools
A B Shinde
 
Electrical Wire Model
Electrical Wire ModelElectrical Wire Model
Electrical Wire Model
VARUN KUMAR
 

What's hot (20)

Embedded Systems (18EC62) – Embedded System Components (Module 3)
Embedded Systems (18EC62) – Embedded System Components (Module 3)Embedded Systems (18EC62) – Embedded System Components (Module 3)
Embedded Systems (18EC62) – Embedded System Components (Module 3)
 
Node level simulators
Node level simulatorsNode level simulators
Node level simulators
 
Microcontrollers 8051 MSP430 notes
Microcontrollers 8051 MSP430 notesMicrocontrollers 8051 MSP430 notes
Microcontrollers 8051 MSP430 notes
 
Schedule Based MAC Protocol
Schedule Based MAC ProtocolSchedule Based MAC Protocol
Schedule Based MAC Protocol
 
Vx works RTOS
Vx works RTOSVx works RTOS
Vx works RTOS
 
Vxworks
VxworksVxworks
Vxworks
 
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded SystemsSYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I   Core of Embedded Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
 
IT8602 Mobile Communication Question Bank
IT8602 Mobile Communication Question BankIT8602 Mobile Communication Question Bank
IT8602 Mobile Communication Question Bank
 
Timers and pwm
Timers and pwmTimers and pwm
Timers and pwm
 
CDMA
CDMACDMA
CDMA
 
SoC FPGA Technology
SoC FPGA TechnologySoC FPGA Technology
SoC FPGA Technology
 
Embedded system Design
Embedded system DesignEmbedded system Design
Embedded system Design
 
Typical Embedded System
Typical Embedded SystemTypical Embedded System
Typical Embedded System
 
Unit1
Unit1Unit1
Unit1
 
Embedded System Basics
Embedded System BasicsEmbedded System Basics
Embedded System Basics
 
Timer And Counter in 8051 Microcontroller
Timer And Counter in 8051 MicrocontrollerTimer And Counter in 8051 Microcontroller
Timer And Counter in 8051 Microcontroller
 
Traffic-adaptive Medium Access Protocol
Traffic-adaptive Medium Access ProtocolTraffic-adaptive Medium Access Protocol
Traffic-adaptive Medium Access Protocol
 
Sensor Protocols for Information via Negotiation (SPIN)
Sensor Protocols for Information via Negotiation (SPIN)Sensor Protocols for Information via Negotiation (SPIN)
Sensor Protocols for Information via Negotiation (SPIN)
 
SOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC ToolsSOC Peripheral Components & SOC Tools
SOC Peripheral Components & SOC Tools
 
Electrical Wire Model
Electrical Wire ModelElectrical Wire Model
Electrical Wire Model
 

Similar to Tiny OS

Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
Ajit Nayak
 
Vb net xp_13
Vb net xp_13Vb net xp_13
Vb net xp_13Niit Care
 
ARM-ES MANUAL.pdf
ARM-ES MANUAL.pdfARM-ES MANUAL.pdf
ARM-ES MANUAL.pdf
vidhya1806
 
Jenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery PipelinesJenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery Pipelines
Brent Laster
 
Ae08 system vb_script
Ae08 system vb_scriptAe08 system vb_script
Ae08 system vb_script
confidencial
 
Lesson slides for C programming course
Lesson slides for C programming courseLesson slides for C programming course
Lesson slides for C programming course
Jean-Louis Gosselin
 
M.G.Goman et al (1994) - PII package: Brief description
M.G.Goman et al (1994) - PII package: Brief descriptionM.G.Goman et al (1994) - PII package: Brief description
M.G.Goman et al (1994) - PII package: Brief description
Project KRIT
 
2nd Technical Meeting - WP3
2nd Technical Meeting - WP32nd Technical Meeting - WP3
2nd Technical Meeting - WP3
SLOPE Project
 
CDMA1X Pilot Panorama introduction
CDMA1X Pilot Panorama introductionCDMA1X Pilot Panorama introduction
CDMA1X Pilot Panorama introduction
Tempus Telcosys
 
Micro Frontends
Micro FrontendsMicro Frontends
Micro Frontends
Spyros Ioakeimidis
 
P4_tutorial.pdf
P4_tutorial.pdfP4_tutorial.pdf
P4_tutorial.pdf
PramodhN3
 
IRJET- Design of Low Power 32- Bit RISC Processor using Verilog HDL
IRJET-  	  Design of Low Power 32- Bit RISC Processor using Verilog HDLIRJET-  	  Design of Low Power 32- Bit RISC Processor using Verilog HDL
IRJET- Design of Low Power 32- Bit RISC Processor using Verilog HDL
IRJET Journal
 
Project Proposal Presentation-C.O.D.E-7 Solutions
Project Proposal Presentation-C.O.D.E-7 SolutionsProject Proposal Presentation-C.O.D.E-7 Solutions
Project Proposal Presentation-C.O.D.E-7 Solutions
Diren Dantanarayana
 
Ultima mentor version_7_0_-_required_data_inputs_for_huawei
Ultima mentor version_7_0_-_required_data_inputs_for_huaweiUltima mentor version_7_0_-_required_data_inputs_for_huawei
Ultima mentor version_7_0_-_required_data_inputs_for_huawei
ergash nigmatov
 
Vb net xp_16
Vb net xp_16Vb net xp_16
Vb net xp_16Niit Care
 
SOMNIUM DRT C++ tools for Microchip ARM microcontrollers
SOMNIUM DRT C++ tools for Microchip ARM microcontrollersSOMNIUM DRT C++ tools for Microchip ARM microcontrollers
SOMNIUM DRT C++ tools for Microchip ARM microcontrollers
Daniel O'Hara
 
Visual basic
Visual basicVisual basic
Visual basic
sanjay joshi
 
Larson and toubro
Larson and toubroLarson and toubro
Larson and toubro
anoopc1998
 
Class 1 introduction to embedded systems
Class 1 introduction to embedded systemsClass 1 introduction to embedded systems
Class 1 introduction to embedded systems
SURYAPRAKASH S
 

Similar to Tiny OS (20)

Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
 
Vb net xp_13
Vb net xp_13Vb net xp_13
Vb net xp_13
 
ARM-ES MANUAL.pdf
ARM-ES MANUAL.pdfARM-ES MANUAL.pdf
ARM-ES MANUAL.pdf
 
Jenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery PipelinesJenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery Pipelines
 
Ae08 system vb_script
Ae08 system vb_scriptAe08 system vb_script
Ae08 system vb_script
 
Lesson slides for C programming course
Lesson slides for C programming courseLesson slides for C programming course
Lesson slides for C programming course
 
Session1 c1
Session1 c1Session1 c1
Session1 c1
 
M.G.Goman et al (1994) - PII package: Brief description
M.G.Goman et al (1994) - PII package: Brief descriptionM.G.Goman et al (1994) - PII package: Brief description
M.G.Goman et al (1994) - PII package: Brief description
 
2nd Technical Meeting - WP3
2nd Technical Meeting - WP32nd Technical Meeting - WP3
2nd Technical Meeting - WP3
 
CDMA1X Pilot Panorama introduction
CDMA1X Pilot Panorama introductionCDMA1X Pilot Panorama introduction
CDMA1X Pilot Panorama introduction
 
Micro Frontends
Micro FrontendsMicro Frontends
Micro Frontends
 
P4_tutorial.pdf
P4_tutorial.pdfP4_tutorial.pdf
P4_tutorial.pdf
 
IRJET- Design of Low Power 32- Bit RISC Processor using Verilog HDL
IRJET-  	  Design of Low Power 32- Bit RISC Processor using Verilog HDLIRJET-  	  Design of Low Power 32- Bit RISC Processor using Verilog HDL
IRJET- Design of Low Power 32- Bit RISC Processor using Verilog HDL
 
Project Proposal Presentation-C.O.D.E-7 Solutions
Project Proposal Presentation-C.O.D.E-7 SolutionsProject Proposal Presentation-C.O.D.E-7 Solutions
Project Proposal Presentation-C.O.D.E-7 Solutions
 
Ultima mentor version_7_0_-_required_data_inputs_for_huawei
Ultima mentor version_7_0_-_required_data_inputs_for_huaweiUltima mentor version_7_0_-_required_data_inputs_for_huawei
Ultima mentor version_7_0_-_required_data_inputs_for_huawei
 
Vb net xp_16
Vb net xp_16Vb net xp_16
Vb net xp_16
 
SOMNIUM DRT C++ tools for Microchip ARM microcontrollers
SOMNIUM DRT C++ tools for Microchip ARM microcontrollersSOMNIUM DRT C++ tools for Microchip ARM microcontrollers
SOMNIUM DRT C++ tools for Microchip ARM microcontrollers
 
Visual basic
Visual basicVisual basic
Visual basic
 
Larson and toubro
Larson and toubroLarson and toubro
Larson and toubro
 
Class 1 introduction to embedded systems
Class 1 introduction to embedded systemsClass 1 introduction to embedded systems
Class 1 introduction to embedded systems
 

More from Manash Kumar Mondal

Role of NDLI in Higher Education _ Research, KU.pdf
Role of NDLI in Higher Education _ Research, KU.pdfRole of NDLI in Higher Education _ Research, KU.pdf
Role of NDLI in Higher Education _ Research, KU.pdf
Manash Kumar Mondal
 
Various security issues and its solutions in the
Various security issues and its solutions in theVarious security issues and its solutions in the
Various security issues and its solutions in the
Manash Kumar Mondal
 
Omicron - A Covid 19 variant
Omicron - A Covid 19 variantOmicron - A Covid 19 variant
Omicron - A Covid 19 variant
Manash Kumar Mondal
 
Computer network
Computer networkComputer network
Computer network
Manash Kumar Mondal
 
Boolean alebra
Boolean alebraBoolean alebra
Boolean alebra
Manash Kumar Mondal
 
Introduction to Algorithm
Introduction to AlgorithmIntroduction to Algorithm
Introduction to Algorithm
Manash Kumar Mondal
 
File in C language
File in C languageFile in C language
File in C language
Manash Kumar Mondal
 
Pegasus, A spyware
Pegasus, A spywarePegasus, A spyware
Pegasus, A spyware
Manash Kumar Mondal
 
A comparative study between cloud computing and fog
A comparative study between cloud computing and fog A comparative study between cloud computing and fog
A comparative study between cloud computing and fog
Manash Kumar Mondal
 
Binary Semaphore
Binary SemaphoreBinary Semaphore
Binary Semaphore
Manash Kumar Mondal
 
Ocean- sat for Oceanography
Ocean- sat for Oceanography Ocean- sat for Oceanography
Ocean- sat for Oceanography
Manash Kumar Mondal
 
Graph theory
Graph  theoryGraph  theory
Graph theory
Manash Kumar Mondal
 
4 g and 5g Communication
4 g and 5g Communication4 g and 5g Communication
4 g and 5g Communication
Manash Kumar Mondal
 
Apache web service
Apache web serviceApache web service
Apache web service
Manash Kumar Mondal
 
Revolution of Mobile Communication, from 1G to 5G Communication
Revolution of Mobile Communication, from  1G to 5G CommunicationRevolution of Mobile Communication, from  1G to 5G Communication
Revolution of Mobile Communication, from 1G to 5G Communication
Manash Kumar Mondal
 
Introduction to Apache Web Services using latex
 Introduction to Apache Web Services using latex Introduction to Apache Web Services using latex
Introduction to Apache Web Services using latex
Manash Kumar Mondal
 
Cloud computing and Cloudsim
Cloud computing and CloudsimCloud computing and Cloudsim
Cloud computing and Cloudsim
Manash Kumar Mondal
 
Superscalar Processor
Superscalar ProcessorSuperscalar Processor
Superscalar Processor
Manash Kumar Mondal
 

More from Manash Kumar Mondal (18)

Role of NDLI in Higher Education _ Research, KU.pdf
Role of NDLI in Higher Education _ Research, KU.pdfRole of NDLI in Higher Education _ Research, KU.pdf
Role of NDLI in Higher Education _ Research, KU.pdf
 
Various security issues and its solutions in the
Various security issues and its solutions in theVarious security issues and its solutions in the
Various security issues and its solutions in the
 
Omicron - A Covid 19 variant
Omicron - A Covid 19 variantOmicron - A Covid 19 variant
Omicron - A Covid 19 variant
 
Computer network
Computer networkComputer network
Computer network
 
Boolean alebra
Boolean alebraBoolean alebra
Boolean alebra
 
Introduction to Algorithm
Introduction to AlgorithmIntroduction to Algorithm
Introduction to Algorithm
 
File in C language
File in C languageFile in C language
File in C language
 
Pegasus, A spyware
Pegasus, A spywarePegasus, A spyware
Pegasus, A spyware
 
A comparative study between cloud computing and fog
A comparative study between cloud computing and fog A comparative study between cloud computing and fog
A comparative study between cloud computing and fog
 
Binary Semaphore
Binary SemaphoreBinary Semaphore
Binary Semaphore
 
Ocean- sat for Oceanography
Ocean- sat for Oceanography Ocean- sat for Oceanography
Ocean- sat for Oceanography
 
Graph theory
Graph  theoryGraph  theory
Graph theory
 
4 g and 5g Communication
4 g and 5g Communication4 g and 5g Communication
4 g and 5g Communication
 
Apache web service
Apache web serviceApache web service
Apache web service
 
Revolution of Mobile Communication, from 1G to 5G Communication
Revolution of Mobile Communication, from  1G to 5G CommunicationRevolution of Mobile Communication, from  1G to 5G Communication
Revolution of Mobile Communication, from 1G to 5G Communication
 
Introduction to Apache Web Services using latex
 Introduction to Apache Web Services using latex Introduction to Apache Web Services using latex
Introduction to Apache Web Services using latex
 
Cloud computing and Cloudsim
Cloud computing and CloudsimCloud computing and Cloudsim
Cloud computing and Cloudsim
 
Superscalar Processor
Superscalar ProcessorSuperscalar Processor
Superscalar Processor
 

Recently uploaded

Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 

Recently uploaded (20)

Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 

Tiny OS

  • 1. TINYOS CREATING APPLICATIONS FOR WIRELESS SENSORS M.Tech Part I 1st Semester University of kalyani 5/31/2018 Riman Mandal, mandal.riman@gmail.com 1
  • 2. Overview Sensor code (nesC/TinyOS) Base station code (nesC/TinyOS) Gateway code (Java, c, …) Serial/USB Wireless Communication iris/sensor 5/31/2018 Riman Mandal, mandal.riman@gmail.com 2
  • 3. Required Hardwares ■ Programming Board ■ Mote ■ Sensing Board ■ And a PC of course…. A Typical Mote 5/31/2018 Riman Mandal, mandal.riman@gmail.com 3
  • 4. Typical Programming Board For Practical Purpose We have a different model 5/31/2018 Riman Mandal, mandal.riman@gmail.com 4
  • 5. Typical Sensor Board For Practical Purpose We have a different model 5/31/2018 Riman Mandal, mandal.riman@gmail.com 5
  • 6. Typical Mote Antenna Interface Power Button 2 AA battery Section For Practical Purpose We have a different model 5/31/2018 Riman Mandal, mandal.riman@gmail.com 6
  • 7. Tiny OS ■ An operating system for low power, embedded, wireless devices – Wireless sensor networks (WSNs) – Sensor-actuator networks – Embedded robotics ■ Open source, open developer community ■ http://www.tinyos.net ■ E-book: TinyOS Programming: http://csl.stanford.edu/~pal/pubs/tinyos- programming.pdf 5/31/2018 Riman Mandal, mandal.riman@gmail.com 7
  • 8. Tiny OS (Cont.) ■ An open-source development environment ■ Not an operation system for general purpose, it is designed for wireless embedded sensor network. ■ Programming language: NesC (an extension of C) ■ It features a component-based architecture. ■ Supported platforms include Linux, Windows 2000/XP with Cygwin. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 8
  • 9. Installation ■ Need Ubuntu 12.04 LTS for hassle free installation. ■ Try installing TinyOS ON Windows machines using VMWare or Virtual Box. ■ I will send the details of Installation via e-mail. ■ If you are interested we can try on Windows using Cygwin. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 9
  • 10. Installing TinyOS 2.1.2 on Ubuntu 12.04 LTS using Virtual Box 5/31/2018 Riman Mandal, mandal.riman@gmail.com 10
  • 11. Preprocessing ■ Install VirtualBox on your Windows machine. ■ Install Ubuntu 12.04LTS inside the Virtual Machine. ■ Start the Ubuntu from Virtual machine. ■ Open Ubuntu Terminal. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 11
  • 12. Step 1 Adding TinyOS Source ■ Execute the following command, ■ Paste the line given below at the end of the file ■ Save the file and quit 5/31/2018 Riman Mandal, mandal.riman@gmail.com 12 sudo gedit /etc/apt/sources.list deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main
  • 13. Step 2 Installing TinyOS ■ First update the TinyOS source using. ■ Use the following command to install TinyOS on your Ubuntu machine. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 13 sudo apt-get update sudo apt-get install tinyos2.1.2
  • 14. Step 3 Environment Setup ■ Enter the following command to edit the Environment setup in Ubuntu ■ Add the following line at the end of the ~/.bashrc file. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 14 sudo gedit ~/.bashrc #Sourcing the tinyos environment variable setup script source /opt/tinyos-2.1.2/tinyos.sh export CLASSPATH=$CLASSPATH:.
  • 15. Step 4 Creating the Environment Source File ■ Create the setup script file using the command ■ Now enter the following contents into this file 5/31/2018 Riman Mandal, mandal.riman@gmail.com 15 sudo gedit /opt/tinyos-2.1.2/tinyos.sh #echo "Setting up for TinyOS 2.1.2" export TOSROOT= export TOSDIR= export MAKERULES= TOSROOT="/opt/tinyos-2.1.2" TOSDIR="$TOSROOT/tos" CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:$TOSROOT/support/sdk /java/tinyos.jar MAKERULES="$TOSROOT/support/make/Makerules" export TOSROOT export TOSDIR export CLASSPATH export MAKERULES
  • 16. Step 5 Permission for Setup Script and Refresh Environment ■ Run the command below to allow this script to execute ■ To refresh the environment with new setup - close and start a new terminal or alternatively execute the following command 5/31/2018 Riman Mandal, mandal.riman@gmail.com 16 sudo chmod 755 /opt/tinyos-2.1.2/tinyos.sh source ~/.bashrc
  • 17. Checking if Installation is successful ■ Run the command to check TOS environment setup is complete or not ■ If it gives warnings related to Java version then do ■ If your version is above 1.5, then ignore this warning else upgrade to a newer java version. Ignore the warning related to graphviz. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 17 tos-check-env java -version
  • 18. TinyOS Programming 5/31/2018 Riman Mandal, mandal.riman@gmail.com 18
  • 19. Basic Idea ■ HURRY UP AND SLEEP!! – Sleep as often as possible to save power ■ Programs are built out of components – Libraries and components are written in nesC. – Applications are too -- just additional components composed with the OS components. ■ Each component is specified by an interface – Provides “hooks” for wiring components together ■ Components are statically wired together based on their interfaces – Increases runtime efficiency 5/31/2018 Riman Mandal, mandal.riman@gmail.com 19
  • 20. Basic Unit of Programming ■ Basic unit of nesC code is a component ■ Components connect via interfaces – Connections called “wiring” 5/31/2018 Riman Mandal, mandal.riman@gmail.com 20 B A interface
  • 21. What is a Component? ■ A component is a file (names must match) ■ Modules are components that have variables and executable code ■ Configurations are components that wires other components together ■ A component does not care if another component is a module or configuration ■ A component may be composed of other components via configurations 5/31/2018 Riman Mandal, mandal.riman@gmail.com 21
  • 22. Component Example 5/31/2018 Riman Mandal, mandal.riman@gmail.com 22 TimerC BlinkC Timer module BlinkC { uses interface Timer<TMilli> as Timer0 provide interface xxxx} implementation { int c; void increment() {c++;} event void Timer0.fired() { call Leds.led0Toggle(); } } configuration BlinkAppC { } implementation { components MainC, BlinkC, LedsC; components new TimerMilliC() as Timer0; BlinkC.Timer0 -> Timer0; BlinkC -> MainC.Boot; BlinkC.Leds -> LedsC; }
  • 23. Singletons and Generics 5/31/2018 Riman Mandal, mandal.riman@gmail.com 23 ■ Singleton components are unique: they exist in a global namespace ■ Generics are instantiated: each instantiation is a new, independent copy configuration BlinkC { … } implementation { components new TimerC(); components BlinkC; BlinkC.Timer -> TimerC; }
  • 24. Component Syntax - Module 5/31/2018 Riman Mandal, mandal.riman@gmail.com 24 ■ A component specifies a set of interfaces by which it is connected to other components – provides a set of interfaces to others – uses a set of interfaces provided by others module ForwarderM { provides { interface StdControl; } uses { interface StdControl as CommControl; interface ReceiveMsg; interface SendMsg; interface Leds; } } implementation { …// code implementing all provided commands and used events } ForwarderM StdControl ReceiveMsg provides uses CommControl SendMsg Leds
  • 25. Component Syntax - Configuration 5/31/2018 Riman Mandal, mandal.riman@gmail.com 25 configuration Forwarder { } implementation { components Main, LedsC; components GenericComm as Comm; components ForwarderM; Main.StdControl -> ForwarderM.StdControl; ForwarderM.CommControl -> Comm; ForwarderM.SendMsg -> Comm.SendMsg[AM_INTMSG]; ForwarderM.ReceiveMsg -> Comm.ReceiveMsg[AM_INTMSG]; ForwarderM.Leds -> LedsC; } Component Selection Wiring the Components together ForwarderM StdControl ReceiveMsg provides uses CommControl SendMsg Leds Main StdControl LedsC Leds GenericComm SendMsg ReceiveMsg StdControl Forwarder
  • 26. Interface 5/31/2018 Riman Mandal, mandal.riman@gmail.com 26 ■ Collections of related functions ■ Define how components connect ■ Interfaces are bi-directional: for A->B – Commands are from A to B – Events are from B to A ■ Can have parameters (types) interface Timer<tag> { command void startOneShot(uint32_t period); command void startPeriodic(uint32_t period); event void fired(); }
  • 27. Interface (provide and use) 5/31/2018 Riman Mandal, mandal.riman@gmail.com 27 User Provider Interface Commands Events Module BlinkC { use interface xxxx; provide interface xxxxxxx; ......... }
  • 28. Interface (provide and use) (Cont.) ■ A component provides and uses interfaces. ■ A interface defines a logically related set of commands and events. ■ Components implement the events they use and the commands they provide: 5/31/2018 Riman Mandal, mandal.riman@gmail.com 28 Component Commands Events Use Can call Must implement Provide Must implement Can signal
  • 29. Terminal Commands related to TinyOS ■ system modifications – sudo chmod –R 777 /bin – sudo chmod –R 777 /dev ■ applications directory – /opt/tinyos-2.1.1/apps/ ■ making hex image for iris mote without sensor board – make iris ■ making hex image for iris mote with sensor board – SENSORBOARD=mda100 make iris ■ burning hex image into iris mote – make <mote> install.moteid burnerid,/dev/tty<serialport> – EX. make iris install.0 mib520,/dev/ttyUSB0 – EX. make iris reinstall.0 mib520,/dev/ttyUSB0 ■ burning hex image into iris mote with sensor board ■ SENSORBOARD=mda100 make iris reinstall.0 mib520,/dev/ttyUSB0 5/31/2018 Riman Mandal, mandal.riman@gmail.com 29
  • 30. Power Up Testing Programing ■ Try to build a tinyOS app that turn on the Red Led on Power up. 5/31/2018 Riman Mandal, mandal.riman@gmail.com 30 PowerUpC uses Boot Leds MainC Boot LedsC Leds
  • 31. Code 5/31/2018 Riman Mandal, mandal.riman@gmail.com 31 configuration PowerupAppC{} implementation { components MainC, PowerupC, LedsC; MainC.Boot <- PowerupC.Boot; PowerupC.Leds -> LedsC.Leds; } module PowerupC @safe() { uses interface Boot; uses interface Leds; } implementation { event void Boot.booted() { call Leds.led0On(); } }
  • 32. Blink App Using Timer<TMilli> C ■ The Red light will blink continuously with a time interval 5/31/2018 Riman Mandal, mandal.riman@gmail.com 32 BlinkC uses Boot Leds MainC Boot LedsC
  • 33. Using Printf Component ■ Include printf.h header file in the module file ■ Use Printf method to print anything on terminal ■ Add Component PrintfC in the Component File ■ Use the following command to print on the terminal – java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSB1:iris 5/31/2018 Riman Mandal, mandal.riman@gmail.com 33 java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSBXXX:telosb