I have a simple example in attachement. It could help. You need a serial 
forwarder to display what will be comming out of the rs232, othewise strange 
displays will occur when using a terminal like gtkterm.

 

You only need to wire the SerialPrintfC in one component of your project and 
afterwards you can use printf anywhere else.

 

Symon
 


Date: Mon, 9 Mar 2009 16:29:06 +0100
From: [email protected]
To: [email protected]
Subject: [Tinyos-help] helloworld with nesC




---------- Forwarded message ----------
From: chouaieb jalloul <[email protected]>
Date: Mon, Mar 9, 2009 at 4:03 PM
Subject: Re: [Tinyos-help] helloworld with nesC
To: Faisal Aslam <[email protected]>


thank you for your response, for now I have a problem to create the application 
on nesc.
In fact, I want to create two components: Helloworld component that provides a 
hello interface and its implementation. and a component helloclient that uses 
helloworld component to print the message "hello world".
this the source code of HelloworldM.nc:
///////////
#include <stdio.h>
#include <stdlib.h>

module HelloworldM {
provides {
    interface Hello;
}
}
implementation {
    command void Hello.sayhello() {
        printf("hello world!");
    }
}
///////////

the hello  interface: Hello.nc:

///////////
interface Hello{
command void sayhello();
}
///////////

my problem is in creating the helloclient component, how should it look like? I 
don't know how to use main method in it to create an executable.
I am basing on my experience on Java and I don't know if it's possible or not 
with nesC.
best regards,

chouaieb




On Mon, Mar 9, 2009 at 3:38 PM, Faisal Aslam <[email protected]> 
wrote:

It is possible. You can use ncc compiler directly to compile NesC code. More 
information is http://www.tinyos.net/tinyos-1.x/doc/nesc/ncc.html

best regards,
Faisal


chouaieb jalloul wrote:




Hello,
I started to learn about nesC since a week. To become more familiar with it, I 
tried to build a simple helloworld application with it using components and 
interfaces. I would like to run a program independently from TinyOS but till 
now I couldn't build this example.
I'd like to know if it's possible to do that and how.
best regards,

Chouaieb
------------------------------------------------------------------------

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



-- 
Jalloul Chouaieb
telecommunication engineer
tel:(+33) 6 47 86 79 27 / (+216) 97 801 815


-- 
Jalloul Chouaieb
telecommunication engineer
tel:(+33) 6 47 86 79 27 / (+216) 97 801 815

_________________________________________________________________
Experience all of the new features, and Reconnect with your life.
http://go.microsoft.com/?linkid=9650730

Attachment: SerialPrintfP.nc
Description: Binary data

Attachment: SerialPrintfC.nc
Description: Binary data

COMPONENT=HelloWorldC
CFLAGS += -I/opt/tinyos-2.x/tos/lib/printf/

CFLAGS+= -DTOSH_DATA_LENGTH=28
include $(MAKERULES)

Attachment: HelloWorldP.nc
Description: Binary data

Attachment: HelloWorldC.nc
Description: Binary data

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to