Go Down

Topic: Multiple (dynamic #) DallasTemperature sensors (Read 3434 times) previous topic - next topic

ottehoman

O hail, the oracle has spoken.
Thank you for your extremely valuable feedback.

afremont

<G>  I think he's trying to say that you should enumerate them by their internal serial number since it is unique to each device.  But, I can certainly see the challenge of trying to remember which 64-bit number was assigned to the attic.  I think he might also be thinking that you might want to determine their serial numbers in a small circuit that just gives you the serial number of one device at a time, so that know what they are before they ever connect to your real network.  Then you can have your software all ready when the device comes online.  I'm not telepathic, so I could be way off on my thinking.  :)
Experience, it's what you get when you were expecting something else.

ottehoman

#17
Mar 08, 2013, 01:01 am Last Edit: Mar 08, 2013, 01:20 am by ottehoman Reason: 1
Thanks for thinking along, you're right.

Oh no... it must be so "utterly useful" to write code that fills the the entire top line of a 2x16 LCD display with an 8byte address, and have the associated temperature on the second line, and then have a piece of post-it stuck to it saying which device is located where ... ;-)

On the side ... why is it that dudes who reply 5 times to a fairly simple and reasonably well documented question, who miss the point of the question, who give zero input (but loads of criticism), who 'allude to a program' that 'was around on the forum around 3 months ago' which 'he believed' to do something, who think that naming of devices 'is extremely weird' and who think that identifying hooked up sensors by physically stimulating them and looking for a response is 'utterly pointless' and 'dumb' - why is that dudes like that are a Sr. Member after 3 months on the forum, and get 3 1/2 stars and 5 Karmas ? 42, Don't PANIC, Keep Calm and Carry On ...



Nick_Pyner

#18
Mar 08, 2013, 01:16 am Last Edit: Mar 08, 2013, 04:58 am by Nick_Pyner Reason: 1

I'm not telepathic,


Not much telepathy needed there, the address-finder that comes with the DS18B20 library does exactly what you describe. The sensor with that address is assigned to the attic exactly as you describe, and that sensor is henceforth called "attic". Then, and only then, Arduino can tell you "it is 27.23 deg. in the attic".  What could be simpler than that?

One thing you can be sure of is that the Arduino is not telepathetic either. I therefore submit that, if you don't tell it which sensor is where, it is not going to tell you which temperature is where.  

michinyon

Quote
I write code (or what looks like it) in nearly any language (apart from probably assembler, although I did do some M6509 stuff way back in 1988 or so), java and js, C shell, python, Matlab, F77 and F90, Basic, Pascal, C++, Qt, etc., whatever suits the application best, or whatever is available. Not particularly good at it (as one previous contributor said) but I get around. Typical physicist ...

The DevAddress[] = tmp trick was more sort-of-like meta-code, not real. Although one could possibly do something like it with the use of pointers, malloc(), memcp() and sizeof(), I guess. Apologize for the confusion caused.


Well it doesn't matter how many languages you know.   If you want to copy the contents of one 8-char array to another,   you don't get that outcome by attempting to assign the name of one array to the other.   Not in C.

The code of yours will assign to DevAddress,  the value of the location of tmp.  It's a pointer assignment.  Which is actually ok, except when you read the next value of tmp for the next device.    That approach will not give you the array of device ID codes which you actually want.

You can copy the elements of tmp[] char by char,   as I suggested.   Or you could get fancy and use something like memcpy().

afremont

He could put it in a structure and then simple assignment works by copying the elements.  How consistent and sensible is that when compare to the rest of language regarding assignment?  I can see the OP's point, I use many languages and the only consistent thing is that they aren't consistent in the syntax or order of evaluation rules.   
Experience, it's what you get when you were expecting something else.

Go Up