2010년 4월 30일 금요일

TinyOS 상에서의 Printf문 출력하기

#CVS 설치
cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login

cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P modulename

modulename은 .으로 해도 됨




1.Makefile

CFLAGS += -I$(TOSDIR)/lib/printf

를 추가적으로 입력한다.

2.*AppC.nc

#include "printf.h"

configuration BlinkAppC
{
}
implementation
{
components MainC, BlinkC, LedsC;
components new TimerMilliC() as Timer0;
components new TimerMilliC() as Timer1;
components new TimerMilliC() as Timer2;


BlinkC -> MainC.Boot;

BlinkC.Timer0 -> Timer0;
BlinkC.Timer1 -> Timer1;
BlinkC.Timer2 -> Timer2;
BlinkC.Leds -> LedsC;
}

3. *C.nc
#include "Timer.h"
#include "printf.h"

module BlinkC
{
uses interface Timer as Timer0;
uses interface Timer as Timer1;
uses interface Timer as Timer2;
uses interface Leds;
uses interface Boot;
}
implementation
{
event void Boot.booted()
{
call Timer0.startPeriodic( 250 );
call Timer1.startPeriodic( 500 );
call Timer2.startPeriodic( 1000 );

printf("Hi I am writing to you from my TinyOS application!!\n");

printfflush();
}

하이퍼 터미널 이용시

bourate : 115200


java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telos

댓글 없음:

댓글 쓰기