<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://anrg.usc.edu/contiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lgadde</id>
		<title>Contiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://anrg.usc.edu/contiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lgadde"/>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php/Special:Contributions/Lgadde"/>
		<updated>2026-07-18T16:29:46Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=415</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=415"/>
				<updated>2014-05-12T05:07:29Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Problem with compling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
Use the following command (replace &amp;lt;username&amp;gt; with your account):&lt;br /&gt;
&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
-OR-&lt;br /&gt;
&lt;br /&gt;
 sudo usermod -a -G dialout &amp;lt;username&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These two commands are equivalent. They both will add username to the dialout group. You will then have to re-login to or reboot your computer for the changes to take effect. You should now have read/write permissions to your USB serial devices. It is not necessary to remove any packages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Trying the following command which should give  the desired output&lt;br /&gt;
&lt;br /&gt;
  make TARGET=sky sky-motelist &lt;br /&gt;
&lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
&lt;br /&gt;
  ../../tools/sky/motelist-linux &lt;br /&gt;
  Reference  Device           Description &lt;br /&gt;
  ---------- ---------------- --------------------------------------------- &lt;br /&gt;
  M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
&lt;br /&gt;
To resolve the issue do the following.&lt;br /&gt;
 &lt;br /&gt;
  sudo apt-get remove modemmanager&lt;br /&gt;
  sudo adduser $USER dialout (or)&lt;br /&gt;
  sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
  // replace $USER by the username&lt;br /&gt;
  sudo reboot&lt;br /&gt;
  id -Gn&lt;br /&gt;
&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
  ls -l /dev/ttyUSB0&lt;br /&gt;
  crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or permissions. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above does not work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;br /&gt;
&lt;br /&gt;
===== Problem with compling in Cooja =====&lt;br /&gt;
If you get an error in the linking there may be 2 possible places u need to check to correct them.&lt;br /&gt;
&lt;br /&gt;
            LD        example-netflood.sky&lt;br /&gt;
            /usr/lib/gcc/msp430/4.6.3/../../../../msp430/lib/mmpy-16/libc.a(rand.o):(.debug_info+0xd3): &lt;br /&gt;
            relocation truncated to fit: R_MSP430_16_BYTE against `no symbol&amp;#039;&lt;br /&gt;
            collect2: ld returned 1 exit status&lt;br /&gt;
            make: *** [example-netflood.sky] Error 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, check the line near 132 in file : contiki/cpu/msp430/Makefile.msp430&lt;br /&gt;
&lt;br /&gt;
which looks like the following&lt;br /&gt;
&lt;br /&gt;
         CFLAGSNO = -Wall -mmcu=$(CC_MCU) -g $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
and delete the option “-g”.&lt;br /&gt;
&lt;br /&gt;
The line should look like :&lt;br /&gt;
&lt;br /&gt;
        CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
Use the second one if the first doesnot work.&lt;br /&gt;
&lt;br /&gt;
Second one is go to the Makefile of the currently compling program and remove the line which looks similar to the following.&lt;br /&gt;
&lt;br /&gt;
        CFLAGS += -g&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=409</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=409"/>
				<updated>2014-04-25T23:57:35Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Problem with compling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
Use the following command (replace &amp;lt;username&amp;gt; with your account):&lt;br /&gt;
&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
-OR-&lt;br /&gt;
&lt;br /&gt;
 sudo usermod -a -G dialout &amp;lt;username&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These two commands are equivalent. They both will add username to the dialout group. You will then have to re-login to or reboot your computer for the changes to take effect. You should now have read/write permissions to your USB serial devices. It is not necessary to remove any packages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Trying the following command which should give  the desired output&lt;br /&gt;
&lt;br /&gt;
  make TARGET=sky sky-motelist &lt;br /&gt;
&lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
&lt;br /&gt;
  ../../tools/sky/motelist-linux &lt;br /&gt;
  Reference  Device           Description &lt;br /&gt;
  ---------- ---------------- --------------------------------------------- &lt;br /&gt;
  M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
&lt;br /&gt;
To resolve the issue do the following.&lt;br /&gt;
 &lt;br /&gt;
  sudo apt-get remove modemmanager&lt;br /&gt;
  sudo adduser $USER dialout (or)&lt;br /&gt;
  sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
  // replace $USER by the username&lt;br /&gt;
  sudo reboot&lt;br /&gt;
  id -Gn&lt;br /&gt;
&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
  ls -l /dev/ttyUSB0&lt;br /&gt;
  crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or permissions. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above does not work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;br /&gt;
&lt;br /&gt;
===== Problem with compling =====&lt;br /&gt;
If you get an error in the linking there may be 2 possible places u need to check to correct them.&lt;br /&gt;
&lt;br /&gt;
            LD        example-netflood.sky&lt;br /&gt;
            /usr/lib/gcc/msp430/4.6.3/../../../../msp430/lib/mmpy-16/libc.a(rand.o):(.debug_info+0xd3): &lt;br /&gt;
            relocation truncated to fit: R_MSP430_16_BYTE against `no symbol&amp;#039;&lt;br /&gt;
            collect2: ld returned 1 exit status&lt;br /&gt;
            make: *** [example-netflood.sky] Error 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, check the line near 132 in file : contiki/cpu/msp430/Makefile.msp430&lt;br /&gt;
&lt;br /&gt;
which looks like the following&lt;br /&gt;
&lt;br /&gt;
         CFLAGSNO = -Wall -mmcu=$(CC_MCU) -g $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
and delete the option “-g”.&lt;br /&gt;
&lt;br /&gt;
The line should look like :&lt;br /&gt;
&lt;br /&gt;
        CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
Use the second one if the first doesnot work.&lt;br /&gt;
&lt;br /&gt;
Second one is go to the make file of the currently compling program and remove the line which looks similar to the following.&lt;br /&gt;
&lt;br /&gt;
        CFLAGS += -g&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=408</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=408"/>
				<updated>2014-04-25T23:55:39Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* = Problem with compling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
Use the following command (replace &amp;lt;username&amp;gt; with your account):&lt;br /&gt;
&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
-OR-&lt;br /&gt;
&lt;br /&gt;
 sudo usermod -a -G dialout &amp;lt;username&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These two commands are equivalent. They both will add username to the dialout group. You will then have to re-login to or reboot your computer for the changes to take effect. You should now have read/write permissions to your USB serial devices. It is not necessary to remove any packages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Trying the following command which should give  the desired output&lt;br /&gt;
&lt;br /&gt;
  make TARGET=sky sky-motelist &lt;br /&gt;
&lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
&lt;br /&gt;
  ../../tools/sky/motelist-linux &lt;br /&gt;
  Reference  Device           Description &lt;br /&gt;
  ---------- ---------------- --------------------------------------------- &lt;br /&gt;
  M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
&lt;br /&gt;
To resolve the issue do the following.&lt;br /&gt;
 &lt;br /&gt;
  sudo apt-get remove modemmanager&lt;br /&gt;
  sudo adduser $USER dialout (or)&lt;br /&gt;
  sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
  // replace $USER by the username&lt;br /&gt;
  sudo reboot&lt;br /&gt;
  id -Gn&lt;br /&gt;
&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
  ls -l /dev/ttyUSB0&lt;br /&gt;
  crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or permissions. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above does not work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;br /&gt;
&lt;br /&gt;
===== Problem with compling =====&lt;br /&gt;
If you get an error in the linking there may be 2 possible places u need to check to correct them.&lt;br /&gt;
&lt;br /&gt;
            LD        example-netflood.sky&lt;br /&gt;
            /usr/lib/gcc/msp430/4.6.3/../../../../msp430/lib/mmpy-16/libc.a(rand.o):(.debug_info+0xd3): relocation truncated to fit: R_MSP430_16_BYTE against `no symbol&amp;#039;&lt;br /&gt;
            collect2: ld returned 1 exit status&lt;br /&gt;
            make: *** [example-netflood.sky] Error 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, check the line near 132 in file : contiki/cpu/msp430/Makefile.msp430&lt;br /&gt;
&lt;br /&gt;
which looks like the following&lt;br /&gt;
&lt;br /&gt;
         CFLAGSNO = -Wall -mmcu=$(CC_MCU) -g $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
and delete the option “-g”.&lt;br /&gt;
&lt;br /&gt;
The line should look like :&lt;br /&gt;
&lt;br /&gt;
        CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
Use the second one if the first doesnot work.&lt;br /&gt;
&lt;br /&gt;
Second one is go to the make file of the currently compling program and remove the line which looks similar to the following.&lt;br /&gt;
&lt;br /&gt;
        CFLAGS += -g&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=407</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=407"/>
				<updated>2014-04-25T23:54:08Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
Use the following command (replace &amp;lt;username&amp;gt; with your account):&lt;br /&gt;
&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
-OR-&lt;br /&gt;
&lt;br /&gt;
 sudo usermod -a -G dialout &amp;lt;username&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These two commands are equivalent. They both will add username to the dialout group. You will then have to re-login to or reboot your computer for the changes to take effect. You should now have read/write permissions to your USB serial devices. It is not necessary to remove any packages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Trying the following command which should give  the desired output&lt;br /&gt;
&lt;br /&gt;
  make TARGET=sky sky-motelist &lt;br /&gt;
&lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
&lt;br /&gt;
  ../../tools/sky/motelist-linux &lt;br /&gt;
  Reference  Device           Description &lt;br /&gt;
  ---------- ---------------- --------------------------------------------- &lt;br /&gt;
  M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
&lt;br /&gt;
To resolve the issue do the following.&lt;br /&gt;
 &lt;br /&gt;
  sudo apt-get remove modemmanager&lt;br /&gt;
  sudo adduser $USER dialout (or)&lt;br /&gt;
  sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
  // replace $USER by the username&lt;br /&gt;
  sudo reboot&lt;br /&gt;
  id -Gn&lt;br /&gt;
&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
  ls -l /dev/ttyUSB0&lt;br /&gt;
  crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or permissions. &lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above does not work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;br /&gt;
&lt;br /&gt;
===== Problem with compling ====&lt;br /&gt;
If you get an error in the linking there may be 2 possible places u need to check to correct them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;LD        example-netflood.sky&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;/usr/lib/gcc/msp430/4.6.3/../../../../msp430/lib/mmpy-16/libc.a(rand.o):(.debug_info+0xd3): relocation truncated to fit: R_MSP430_16_BYTE against `no symbol&amp;#039;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;collect2: ld returned 1 exit status&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;make: *** [example-netflood.sky] Error 1&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First, check the line near 132 in file : contiki/cpu/msp430/Makefile.msp430&lt;br /&gt;
&lt;br /&gt;
which looks like the following&lt;br /&gt;
&lt;br /&gt;
         CFLAGSNO = -Wall -mmcu=$(CC_MCU) -g $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
and delete the option “-g”.&lt;br /&gt;
&lt;br /&gt;
The line should look like :&lt;br /&gt;
&lt;br /&gt;
        CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR)&lt;br /&gt;
&lt;br /&gt;
Use the second one if the first doesnot work.&lt;br /&gt;
&lt;br /&gt;
Second one is go to the make file of the currently compling program and remove the line which looks similar to the following.&lt;br /&gt;
&lt;br /&gt;
        CFLAGS += -g&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=316</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=316"/>
				<updated>2014-03-06T05:27:23Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
Trying the following command which should give  the desired output&lt;br /&gt;
&lt;br /&gt;
  make TARGET=sky sky-motelist &lt;br /&gt;
&lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
&lt;br /&gt;
  ../../tools/sky/motelist-linux &lt;br /&gt;
  Reference  Device           Description &lt;br /&gt;
  ---------- ---------------- --------------------------------------------- &lt;br /&gt;
  M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
&lt;br /&gt;
To resolve the issue do the following.&lt;br /&gt;
 &lt;br /&gt;
  sudo apt-get remove modemmanager&lt;br /&gt;
  sudo adduser $USER dialout (or)&lt;br /&gt;
  sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
  // replace $USER by the username&lt;br /&gt;
  sudo reboot&lt;br /&gt;
  id -Gn&lt;br /&gt;
&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
  ls -l /dev/ttyUSB0&lt;br /&gt;
  crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or permissions. &lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=315</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=315"/>
				<updated>2014-03-06T05:26:54Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
Trying the following command which should give  the desired output&lt;br /&gt;
make TARGET=sky sky-motelist &lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
&lt;br /&gt;
  ../../tools/sky/motelist-linux &lt;br /&gt;
  Reference  Device           Description &lt;br /&gt;
  ---------- ---------------- --------------------------------------------- &lt;br /&gt;
  M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
&lt;br /&gt;
To resolve the issue do the following.&lt;br /&gt;
 &lt;br /&gt;
  sudo apt-get remove modemmanager&lt;br /&gt;
  sudo adduser $USER dialout (or)&lt;br /&gt;
  sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
  // replace $USER by the username&lt;br /&gt;
  sudo reboot&lt;br /&gt;
  id -Gn&lt;br /&gt;
&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
  ls -l /dev/ttyUSB0&lt;br /&gt;
  crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or permissions. &lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=314</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=314"/>
				<updated>2014-03-06T05:23:40Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are getting an error &lt;br /&gt;
/dev/ttyUSB0   Can&amp;#039;t open port &lt;br /&gt;
Error 1&lt;br /&gt;
followed by errors in the make file&lt;br /&gt;
&lt;br /&gt;
Trying the following command which should give  the desired output&lt;br /&gt;
make TARGET=sky sky-motelist &lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
../../tools/sky/motelist-linux &lt;br /&gt;
Reference  Device           Description &lt;br /&gt;
---------- ---------------- --------------------------------------------- &lt;br /&gt;
M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
 &lt;br /&gt;
sudo apt-get remove modemmanager&lt;br /&gt;
&lt;br /&gt;
sudo adduser $USER dialout (or)&lt;br /&gt;
sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
// replace $USER by the username&lt;br /&gt;
sudo reboot&lt;br /&gt;
id -Gn&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
ls -l /dev/ttyUSB0&lt;br /&gt;
crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or u permissions &lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=313</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=313"/>
				<updated>2014-03-06T05:22:13Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Then, try few commands like:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following:&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=312</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=312"/>
				<updated>2014-03-06T05:21:30Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=311</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=311"/>
				<updated>2014-03-06T05:20:30Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Try the following questions if the answers are true then this procedure for troubleshooting&lt;br /&gt;
Are you using a 64bit version of Ubuntu?&lt;br /&gt;
Are you using a Ubuntu 12.04 LTS or newer versions of it?&lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=310</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=310"/>
				<updated>2014-03-06T05:19:58Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Try the following questions if the answers are true then this procedure for troubleshooting&lt;br /&gt;
Are you using a 64bit version of Ubuntu?&lt;br /&gt;
Are you using a Ubuntu 12.04 LTS or newer versions of it?&lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ldd serialdump-linux&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
&lt;br /&gt;
  ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
  sudo dpkg --add-architecture i386&lt;br /&gt;
  sudo apt-get update&lt;br /&gt;
  sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=309</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=309"/>
				<updated>2014-03-06T05:18:20Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Try the following questions if the answers are true then this procedure for troubleshooting&lt;br /&gt;
Are you using a 64bit version of Ubuntu?&lt;br /&gt;
Are you using a Ubuntu 12.04 LTS or newer versions of it?&lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ldd serialdump-linux&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
&lt;br /&gt;
ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo dpkg --add-architecture i386&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get update&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=308</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=308"/>
				<updated>2014-03-06T05:17:27Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Issue with make login */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Try the following questions if the answers are true then this procedure for troubleshooting&lt;br /&gt;
Are you using a 64bit version of Ubuntu?&lt;br /&gt;
Are you using a Ubuntu 12.04 LTS or newer versions of it?&lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;ldd serialdump-linux&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
&lt;br /&gt;
ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo dpkg --add-architecture i386&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get update&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=307</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=307"/>
				<updated>2014-03-06T05:15:04Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Issue with make login */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot; or &amp;quot;Command not found&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the above doesnot work &lt;br /&gt;
&lt;br /&gt;
Try the following question if the answers are true then this procedure for troubleshooting&lt;br /&gt;
Are you using a 64bit version of Ubuntu?&lt;br /&gt;
Are you using a Ubuntu 12.04 LTS or newer versions of it?&lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
sudo dpkg --add-architecture i386&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get install ia32-libs&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=306</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=306"/>
				<updated>2014-03-06T05:13:08Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=305</id>
		<title>Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Troubleshooting&amp;diff=305"/>
				<updated>2014-03-06T05:12:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Permission denied */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Main_Page | Back to Main Page]]&lt;br /&gt;
&lt;br /&gt;
===== Permission denied =====&lt;br /&gt;
If you try to connect to a mote and receive a permission error, you may need to add yourself to the dialout group. The error may look something like the following:&lt;br /&gt;
&lt;br /&gt;
 /home/user/contiki/tools/sky/serialdump-linux -b115200 /dev/ttyUSB0&lt;br /&gt;
 connecting to /dev/ttyUSB0 (115200)&lt;br /&gt;
 /dev/ttyUSB0: Permission denied&lt;br /&gt;
 make: *** [login] Error 255&lt;br /&gt;
&lt;br /&gt;
To resolve the issue, simply use the following command:&lt;br /&gt;
 sudo adduser &amp;lt;username&amp;gt; dialout&lt;br /&gt;
&lt;br /&gt;
If that doesnot work&lt;br /&gt;
If you are getting an error &lt;br /&gt;
/dev/ttyUSB0   Can&amp;#039;t open port &lt;br /&gt;
Error 1&lt;br /&gt;
followed by errors in the make file&lt;br /&gt;
&lt;br /&gt;
Trying the following command which should give  the desired output&lt;br /&gt;
make TARGET=sky sky-motelist &lt;br /&gt;
(sky can be replaced by the mote which is being used e.g z1)&lt;br /&gt;
&lt;br /&gt;
The desired output&lt;br /&gt;
../../tools/sky/motelist-linux &lt;br /&gt;
Reference  Device           Description &lt;br /&gt;
---------- ---------------- --------------------------------------------- &lt;br /&gt;
M4A7J5HF   /dev/ttyUSB0     Moteiv tmote sky &lt;br /&gt;
&lt;br /&gt;
This means it is a common serial port connection problem with Ubuntu 12.04 LTS.&lt;br /&gt;
 &lt;br /&gt;
sudo apt-get remove modemmanager&lt;br /&gt;
&lt;br /&gt;
sudo adduser $USER dialout (or)&lt;br /&gt;
sudo usermod -a -G dialout $USER // adds the user to the dialout&lt;br /&gt;
// replace $USER by the username&lt;br /&gt;
sudo reboot&lt;br /&gt;
id -Gn&lt;br /&gt;
And check now if the device is attached to the dialout user group.&lt;br /&gt;
&lt;br /&gt;
ls -l /dev/ttyUSB0&lt;br /&gt;
crw-rw---- 1 root dialout 188, 0 Mar  5 19:58 /dev/ttyUSB0 &lt;br /&gt;
&lt;br /&gt;
There is no need to mess with dev rules or u permissions &lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------------------------------------------------&lt;br /&gt;
If you get a error saying&lt;br /&gt;
&lt;br /&gt;
make: ../../tools/sky/serialdump-linux: Command not found &lt;br /&gt;
make: *** [login] Error 127&lt;br /&gt;
&lt;br /&gt;
Try the following question if the answers are true then this procedure for troubleshooting&lt;br /&gt;
Are you using a 64bit version of Ubuntu?&lt;br /&gt;
Are you using a Ubuntu 12.04 LTS or newer versions of it?&lt;br /&gt;
&lt;br /&gt;
Now, try few commands like &lt;br /&gt;
ldd serialdump-linux&lt;br /&gt;
&lt;br /&gt;
The output look similar to the following&lt;br /&gt;
ldd serialdump-linux&lt;br /&gt;
        linux-gate.so.1 =&amp;gt;  (0xf772d000)&lt;br /&gt;
        libc.so.6 =&amp;gt; /lib32/libc.so.6 (0xf75b4000)&lt;br /&gt;
        /lib/ld-linux.so.2 (0xf772e000)&lt;br /&gt;
&lt;br /&gt;
Then it means that you have to install 32-bit packages. &lt;br /&gt;
Remember to add i386 architecture or you won&amp;#039;t be able to install 32-bit packages:&lt;br /&gt;
sudo dpkg --add-architecture i386&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
sudo apt-get install ia32-libs&lt;br /&gt;
&lt;br /&gt;
===== Issue with make login =====&lt;br /&gt;
If you are trying to execute the serial-dump application (contiki/tools/sky/serialdump-linux) and see the message: &amp;quot;No such file or directory&amp;quot;, it means that you are running in a 64-bit operating system that does not have proper 32-bit libraries installed. Since serialdump-linux is a pre-compiled 32-bit tool you need to execute the following command to install the necessary libraries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;sudo apt-get install ia32-libs&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=149</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=149"/>
				<updated>2014-02-08T00:05:28Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Understanding the code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. A glance at core/net/rime/broadcast.h and core/net/rime/broadcast.c helps in the understanding underlying concepts of this example.&lt;br /&gt;
In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_EXITHANDLER(handler)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler: The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_BEGIN()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition.This macros initiates PT_BEGIN(), which is declared at the starting point of a protothread. All C statements above the PT_BEGIN() invokation will be executed each time the protothread is scheduled.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_close(struct broadcast_conn *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function closes a broadcast connection that has previously been opened with broadcast_open().This function typically is called as an exit handler.&lt;br /&gt;
*broadcast_conn *:  This is same as the variable from boradcast_recv().&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_END()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the end of a process. It must appear in a PROCESS_THREAD() definition and must always be included. The process exits when the PROCESS_END() macro is reached. This macro initiates PT_END().It must always be used together with a matching PT_BEGIN() macro.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_open(struct broadcast_conn *, uint16_t ,const struct broadcast_callbacks *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Sets up an identified best-effort broadcast connection. The caller will allocate the memory for the struct broadcast_conn, usually by declaring it as a static variable. The struct broadcast_callbacks pointer  points to a structure containing a pointer to a function that will be called when a packet arrives on the channel. This function opens a connection of type abc_conn and sets the callbacks to structure passed. Also, this points to channel_set_attributes() function.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *: A pointer to a struct broadcast_conn&lt;br /&gt;
*uint16_t:  The channel on which the connection will operate&lt;br /&gt;
*broadcast_callbacks *:  A struct broadcast_callbacks with function pointers to functions that will be called when a packet has been received&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;etimer_set(struct etimer *, clock_time_t)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is used to set an event timer for a time sometime in the future. When the event timer expires, the event PROCESS_EVENT_TIMER will be posted to the process that called the etimer_set() function.&lt;br /&gt;
&lt;br /&gt;
*etimer *: A pointer to the event timer&lt;br /&gt;
*clock_time_t *: The interval before the timer expires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=148</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=148"/>
				<updated>2014-02-07T23:27:17Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_EXITHANDLER(handler)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler: The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_BEGIN()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition.This macros initiates PT_BEGIN(), which is declared at the starting point of a protothread. All C statements above the PT_BEGIN() invokation will be executed each time the protothread is scheduled.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_close(struct broadcast_conn *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function closes a broadcast connection that has previously been opened with broadcast_open().This function typically is called as an exit handler.&lt;br /&gt;
*broadcast_conn *:  This is same as the variable from boradcast_recv().&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_END()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the end of a process. It must appear in a PROCESS_THREAD() definition and must always be included. The process exits when the PROCESS_END() macro is reached. This macro initiates PT_END().It must always be used together with a matching PT_BEGIN() macro.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_open(struct broadcast_conn *, uint16_t ,const struct broadcast_callbacks *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Sets up an identified best-effort broadcast connection. The caller will allocate the memory for the struct broadcast_conn, usually by declaring it as a static variable. The struct broadcast_callbacks pointer  points to a structure containing a pointer to a function that will be called when a packet arrives on the channel. This function opens a connection of type abc_conn and sets the callbacks to structure passed. Also, this points to channel_set_attributes() function.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *: A pointer to a struct broadcast_conn&lt;br /&gt;
*uint16_t:  The channel on which the connection will operate&lt;br /&gt;
*broadcast_callbacks *:  A struct broadcast_callbacks with function pointers to functions that will be called when a packet has been received&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;etimer_set(struct etimer *, clock_time_t)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is used to set an event timer for a time sometime in the future. When the event timer expires, the event PROCESS_EVENT_TIMER will be posted to the process that called the etimer_set() function.&lt;br /&gt;
&lt;br /&gt;
*etimer *: A pointer to the event timer&lt;br /&gt;
*clock_time_t *: The interval before the timer expires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=147</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=147"/>
				<updated>2014-02-07T23:25:02Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_EXITHANDLER(handler)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler: The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_BEGIN()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition.This macros initiates PT_BEGIN(), which is declared at the starting point of a protothread. All C statements above the PT_BEGIN() invokation will be executed each time the protothread is scheduled.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_close(struct broadcast_conn *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function closes a broadcast connection that has previously been opened with broadcast_open().This function typically is called as an exit handler.&lt;br /&gt;
*broadcast_conn *:  This is same as the variable from boradcast_recv().&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_END()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the end of a process. It must appear in a PROCESS_THREAD() definition and must always be included. The process exits when the PROCESS_END() macro is reached. This macro initiates PT_END().It must always be used together with a matching PT_BEGIN() macro.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_open(struct broadcast_conn *, uint16_t ,const struct broadcast_callbacks *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Sets up an identified best-effort broadcast connection. The caller will allocate the memory for the struct broadcast_conn, usually by declaring it as a static variable. The struct broadcast_callbacks pointer  points to a structure containing a pointer to a function that will be called when a packet arrives on the channel. This function opens a connection of type abc_conn and sets the callbacks to structure passed. Also, this points to channel_set_attributes() function.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *: A pointer to a struct broadcast_conn&lt;br /&gt;
* uint16_t:  The channel on which the connection will operate&lt;br /&gt;
*broadcast_callbacks *:  A struct broadcast_callbacks with function pointers to functions that will be called when a packet has been received&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;etimer_set(struct etimer *, clock_time_t)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is used to set an event timer for a time sometime in the future. When the event timer expires, the event PROCESS_EVENT_TIMER will be posted to the process that called the etimer_set() function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*etimer *: A pointer to the event timer&lt;br /&gt;
*clock_time_t *: The interval before the timer expires.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=146</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=146"/>
				<updated>2014-02-07T22:48:21Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_EXITHANDLER(handler)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler: The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_BEGIN()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition.This macros initiates PT_BEGIN(), which is declared at the starting point of a protothread. All C statements above the PT_BEGIN() invokation will be executed each time the protothread is scheduled.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_close(struct broadcast_conn *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function closes a broadcast connection that has previously been opened with broadcast_open().This function typically is called as an exit handler.&lt;br /&gt;
*broadcast_conn *:  This is same as the variable from boradcast_recv().&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_END()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the end of a process. It must appear in a PROCESS_THREAD() definition and must always be included. The process exits when the PROCESS_END() macro is reached.&lt;br /&gt;
This macro initiates PT_END().It must always be used together with a matching PT_BEGIN() macro.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=145</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=145"/>
				<updated>2014-02-07T22:38:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
PROCESS_EXITHANDLER(handler)&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler: The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_BEGIN()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition.This macros initiates PT_BEGIN(), which is declared at the starting point of a protothread. All C statements above the PT_BEGIN() invokation will be executed each time the protothread is scheduled.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_END()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the end of a process. It must appear in a PROCESS_THREAD() definition and must always be included. The process exits when the PROCESS_END() macro is reached.&lt;br /&gt;
This macro initiates PT_END().It must always be used together with a matching PT_BEGIN() macro.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=144</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=144"/>
				<updated>2014-02-07T22:33:16Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
PROCESS_EXITHANDLER(handler)&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler: The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_BEGIN()&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro defines the beginning of a process, and must always appear in a PROCESS_THREAD() definition.This macros initiates PT_BEGIN(), which is used to declare the starting point of a protothread. All C statements above the PT_BEGIN() invokation will be executed each time the protothread is scheduled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=143</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=143"/>
				<updated>2014-02-07T22:24:57Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
PROCESS_EXITHANDLER(handler)&lt;br /&gt;
&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
*handler The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=142</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=142"/>
				<updated>2014-02-07T22:13:11Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
&lt;br /&gt;
==== Macros and Structures ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS(name,strname) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; AUTOSTART_PROCESS(struct process &amp;amp;) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; broadcast_recv(struct broadcast_conn *, const rimeaddr_t *) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; PROCESS_THREAD(name, process_event_t, process_data_t) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
PROCESS_EXITHANDLER(handler)&lt;br /&gt;
Specify an action when a process exits.&lt;br /&gt;
NOTE This declaration must come immediately before the PROCESS_BEGIN() macro.&lt;br /&gt;
 *handler The action to be performed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=134</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=134"/>
				<updated>2014-02-07T09:57:10Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
(Best effort)&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_THREAD(name, process_event_t, process_data_t)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*process_event_t: The variable of type character.If this variable is same as PROCESS_EVENT_EXIT then PROCESS_EXITHANDLER is invoked.&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=133</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=133"/>
				<updated>2014-02-07T09:40:38Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
(Best effort)&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_THREAD(name,&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
A process in Contiki consists of a single reference to &amp;quot;protothread&amp;quot;.This function is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN()  and end with the PROCESS_END() function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=132</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=132"/>
				<updated>2014-02-07T09:32:35Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
(Best effort)&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_THREAD(name,&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN() macro and end with the PROCESS_END() macro.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=131</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=131"/>
				<updated>2014-02-07T09:24:33Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
(Best effort)&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS_THREAD(name,&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This macro is used to define the protothread of a process. The process is called whenever an event occurs in the system. A process always start with the PROCESS_BEGIN() macro and end with the PROCESS_END() macro.&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=130</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=130"/>
				<updated>2014-02-07T09:21:39Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Understanding the code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this example is to test the broadcast layer in Rime. In the code, a process called example_braodcast_process is  kicked off by AUTOSTART_PROCESSES.&lt;br /&gt;
(Best effort)&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=129</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=129"/>
				<updated>2014-02-07T09:09:15Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Understanding the code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The purpose of this program is to test the broadcast layer in Rime. The program starts to run at PROCESS() function &lt;br /&gt;
(Best effort)&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=128</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=128"/>
				<updated>2014-02-07T09:07:18Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=127</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=127"/>
				<updated>2014-02-07T09:06:04Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t *: This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=126</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=126"/>
				<updated>2014-02-07T09:05:24Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message, address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t : This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=125</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=125"/>
				<updated>2014-02-07T09:04:15Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received. Reads the message and the address of the sender and displays them.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t : This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=124</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=124"/>
				<updated>2014-02-07T09:00:52Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  This structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
*rimeaddr_t : This is union which has a array u8[RIMEADDR_SIZE] of type character.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=123</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=123"/>
				<updated>2014-02-07T06:50:28Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn *:  The structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And, the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=122</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=122"/>
				<updated>2014-02-07T06:48:55Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn:  The structure which has 2 structures : abc_conn, broadcast_callbacks *. The abc_conn is basic type of connection over which the broadcast connection is developed. And ,the broadcast_callbacks point to functions recv and sent functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=121</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=121"/>
				<updated>2014-02-07T06:35:37Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name: The variable name of the process structure.&lt;br /&gt;
*strname: The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name: Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn:  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=120</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=120"/>
				<updated>2014-02-07T06:34:22Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: /* Macros and Structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
*name The variable name of the process structure.&lt;br /&gt;
*strname The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
*&amp;amp;name Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received.&lt;br /&gt;
&lt;br /&gt;
*broadcast_conn &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=119</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=119"/>
				<updated>2014-02-07T06:33:15Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
(Best effort) &lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
Input Parameters :&lt;br /&gt;
*name The variable name of the process structure.&lt;br /&gt;
*strname The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(struct process &amp;amp;)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
Input Parameters: &lt;br /&gt;
*&amp;amp;name Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;broadcast_recv(struct broadcast_conn *, const rimeaddr_t *)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This function is called whenever a broadcast message is received.&lt;br /&gt;
&lt;br /&gt;
Input Parameters:&lt;br /&gt;
*broadcast_conn &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=118</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=118"/>
				<updated>2014-02-07T06:17:42Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
&lt;br /&gt;
=== Macros and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
Input Parameters :&lt;br /&gt;
*name The variable name of the process structure.&lt;br /&gt;
*strname The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(&amp;amp;name)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
Input Parameters: &lt;br /&gt;
*&amp;amp;name Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=117</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=117"/>
				<updated>2014-02-07T06:15:54Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
&lt;br /&gt;
=== Functions and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
&lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
Input Parameters :&lt;br /&gt;
*name The variable name of the process structure.&lt;br /&gt;
*strname The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(&amp;amp;name)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
Input Parameters: &lt;br /&gt;
*&amp;amp;name Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=116</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=116"/>
				<updated>2014-02-07T06:09:56Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
&lt;br /&gt;
=== Functions and Structures ===&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PROCESS(name,strname)&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
Input Parameters :&lt;br /&gt;
name The variable name of the process structure.&lt;br /&gt;
strname The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;AUTOSTART_PROCESS(&amp;amp;name)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The AUTOSTART_PROCESSES definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
Input Parameters: &lt;br /&gt;
&amp;amp;name Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=115</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=115"/>
				<updated>2014-02-07T06:06:13Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
&lt;br /&gt;
=== Functions and Structures ===&lt;br /&gt;
PROCESS(name,strname) &lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
&lt;br /&gt;
Input Parameters :&lt;br /&gt;
&lt;br /&gt;
name The variable name of the process structure.&lt;br /&gt;
strname The string representation of the process name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
AUTOSTART_PROCESS()&lt;br /&gt;
The AUTOSTART_PROCESSES() definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
&lt;br /&gt;
Input Parameters : Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=114</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=114"/>
				<updated>2014-02-07T06:03:08Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
The program starts to run at&lt;br /&gt;
&lt;br /&gt;
=== Functions and Structures ===&lt;br /&gt;
PROCESS(name,strname) &lt;br /&gt;
The process has two names: the variable of the process structure, which is used by the C program, and a human readable string name, which is used when debugging.&lt;br /&gt;
Input Parameters :&lt;br /&gt;
name The variable name of the process structure.&lt;br /&gt;
strname The string representation of the process name.&lt;br /&gt;
AUTOSTART_PROCESS()&lt;br /&gt;
The AUTOSTART_PROCESSES() definition specifices what processes to start when the module is loaded. We can pass more than one process.&lt;br /&gt;
Input Parameters : Refernce to process name&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	<entry>
		<id>http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=113</id>
		<title>Broadcast Example</title>
		<link rel="alternate" type="text/html" href="http://anrg.usc.edu/contiki/index.php?title=Broadcast_Example&amp;diff=113"/>
				<updated>2014-02-07T04:32:47Z</updated>
		
		<summary type="html">&lt;p&gt;Lgadde: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
This exercise is an introduction into programming the [http://www.capsil.org/capsilwiki/index.php/TELOSB/TMote_Sky Tmote Sky]. It uses the Rime stack to communicate with other Contiki nodes over the radio. You will run the broadcast example already found in the Contiki core folders to send your name from a base station via broadcast packets. The exercise sends broadcast packets at random intervals between 20 and 40 seconds such that all Tmote Sky boards nearby will receive the packet. &lt;br /&gt;
&lt;br /&gt;
=== You will learn: ===&lt;br /&gt;
&lt;br /&gt;
* How to program the Broadcast communication found within the Rime stack&lt;br /&gt;
* How to encapsulate data in packets&lt;br /&gt;
&lt;br /&gt;
=== Connect the Tmote Sky: ===&lt;br /&gt;
Before continuing with the tutorial, plug a Tmote Sky into the computer’s USB port. The LEDs on the skymote will start blinking to indicate that the mote is connected.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: ===&lt;br /&gt;
&lt;br /&gt;
The first step is to change directories. At this point you should be familiar with the Contiki 2.7 core folders. The Rime stack is located within the examples folder, so type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; cd contiki-2.7/examples/rime &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
directly into terminal. Once inside the rime folder, use the ls command to view all the files within it. We will be working specifically with example-broadcast.c.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: ===&lt;br /&gt;
&lt;br /&gt;
Next, we will edit the data in the example-broadcast.c packet. In order to do this, you will need to open the packet within your text editor. In this exercise, we use gedit, but feel free to use whichever text editor you are most comfortable with. Type: &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; gedit example-broadcast.c &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
into terminal. This will open your text editor, allowing you to edit the code inside the broadcast packet. &lt;br /&gt;
&lt;br /&gt;
=== Step 3: ===&lt;br /&gt;
&lt;br /&gt;
To edit the actual data that your Tmote Sky will broadcast, scroll down to the line that contains &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“Hello”,  6) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the character string to your name. Then change the number of characters accordingly. Remember to account for the null zero associated with character strings in C when changing the number of characters. The line should now read&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; packetbuf_copyfrom(“yourName”,  9) &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit the text editor. &lt;br /&gt;
&lt;br /&gt;
=== Step 4: ===&lt;br /&gt;
&lt;br /&gt;
In the next step we configure Tmote Sky. Connect your mote to your computer via USB. If you are using VirtualBox or Parallels, assure that the mote actually connects to your virtual machine (the LEDs on the mote will blink when connected to the laptop). &lt;br /&gt;
&lt;br /&gt;
Then in terminal, type &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; sudo chown:user /dev/ttyUSB0 &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password for your user account. If you are running Instant Contiki, the password is user. The sudo [http://en.wikipedia.org/wiki/Chown chown] command is used to change the owner of the file in Unix-systems.&lt;br /&gt;
&lt;br /&gt;
Note: If you manually installed Contiki, you must type in your username instead of user. Then, when prompted to do so, enter your password. &lt;br /&gt;
&lt;br /&gt;
=== Step 5: ===&lt;br /&gt;
&lt;br /&gt;
In this step, we will compile and upload the Broadcast packet to your Tmote Sky. In the terminal window, type&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; make TARGET=sky example-broadcast.upload login &amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice that instead of typing example-broadcast.sky, we use example-broadcast.upload. The .upload tells Contiki to install the binary onto the attached mote. Additionally, we add login to use the terminal to communicate with the mote over the serial interface referred to by /dev/ttyUSB0. Note that login can be specified later in another call to make, i.e. make login.&lt;br /&gt;
&lt;br /&gt;
This should compile and upload the example-broadcast.c packet such that your mote will be able to broadcast your name. After the compilation is complete, the text broadcast message sent...  should appear in terminal every 2 to 4 seconds, indicating that your name (which we added within the text editor) is being broadcast to all other motes in the area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations! You have successfully programmed the Tmote Sky! &amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039;&amp;#039; If at any point, you would like to exit the compilation/broadcast stage, press CTRL-C&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Tip:&amp;#039;&amp;#039;&amp;#039; You can save the TARGET by typing make TARGET=sky savetarget into terminal to avoid compiling the target repeatedly.&lt;br /&gt;
&lt;br /&gt;
=== Understanding the code ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Contiki_tutorials | Back to Contiki Tutorials]]&lt;/div&gt;</summary>
		<author><name>Lgadde</name></author>	</entry>

	</feed>