Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: 1 [2]   Go Down
Author Topic: Multiple (dynamic #) DallasTemperature sensors  (Read 3121 times)
0 Members and 1 Guest are viewing this topic.
Sydney, AUS
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

<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.  smiley
Logged

Experience, it's what you get when you were expecting something else.

Sydney, AUS
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ...




* TCL_3M.png (17.07 KB, 633x571 - viewed 37 times.)

* LCD_img.png (87.37 KB, 323x164 - viewed 22 times.)
« Last Edit: March 07, 2013, 07:20:15 pm by ottehoman » Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2350
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  
« Last Edit: March 07, 2013, 10:58:54 pm by Nick_Pyner » Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3085
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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().
Logged

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.   
Logged

Experience, it's what you get when you were expecting something else.

Pages: 1 [2]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: