On Mon, Oct 28, 2013 at 2:33 AM, Alaios <[email protected]> wrote:

> Hi,
> I appreciate the answer you gave me.
>
> A. If it has to do with scoping why nesC does not complain for the printf
> statement, that has a variable with no assigned value?
>

no idea and I'm not going to spend the time to figure it out.

probably because it is static, which means that C knows that is is
initialized on start up.   Either zero'd (which is what happens in this
case) or pre-initialized.


> What instead of a static variable declaration do a variable declaration
> inside the readDone?
>

I have no idea what you are trying to say in the above sentence.    It
doesn't parse.

I am kind of sure that doing the calculations inside the printf("%d",2+3)
> would work in todays C compiliers
>

yes.


>
> B. I also looked on the light sensor my telosb has but I could not find
> anywhere documented the conversion formula being used over the same video.
> Where one can find this conversion formula? I was able to find the
> temperature and humidity conversion formulas from the official datasheet of
> the chip producer.
>

you'll have to figure this one out yourself.   I don't have time to figure
it out.



>
> I would like to thank you in advance for your help
>
> Regards
> Alex
>
>
>
>   On Monday, October 28, 2013 10:23 AM, Eric Decker <[email protected]>
> wrote:
>
>
>
> On Mon, Oct 28, 2013 at 2:02 AM, Alaios <[email protected]> wrote:
>
> Hi I was looking in the nice tutorial here
>
> http://www.youtube.com/watch?v=x0g4uFr44rk
>
> and I was wondering why at 34:11 we have to declare one more variable for
> the conversion formula to work. I guess this is related to the way tinyos
> works internally.
>
>
> Its not an advanced topic.   Rather it is a C variable scoping topic.
>
> it also has nothing with making the conversion formula work.
>
> It does have everything to do with C scoping of variables.
>
> TempRead.readDone is an event that gets signalled by the h/w driver.  It
> is basically a call out and you have to have some place to put what you
> compute from the value the read gives you.  The value passed in by the
> driver (when calling (signalling) readDone) is call local.  its either in
> registers or on the stack.   Doesn't have a very long lifetime.
>
> So one way is to define a module static, centiGrade.   That gets the
> computation value.
>
> That is what the tutorial guy is doing by defining the module static
> centiGrade.   Because it is inside the implementation block of the module
> its name will be munged by nesc to make sure it is program unique.
>
>
>
>
>
> Can someone shed light on such advanced topic?
>
> R
> Alex
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
>
>
> --
> Eric B. Decker
> Senior (over 50 :-) Researcher
>
>
>
>
>


-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to