tuxmartin

struct array

Jan 7th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. struct Teplomer {
  2.   byte DS18B20ID[9];
  3.   float zmereno;
  4.   float maByt;
  5.   //....
  6. };
  7.  
  8. struct Teplomer;
  9. Teplomer s[2];
  10.  
  11. void setup() {
  12.   s[0].maByt=23.0;
  13.   s[0].DS18B20ID[0] = 0x28;
  14.   s[0].DS18B20ID[0] = {0x28, 0x2E, 0x95, 0xC7, 0x1, 0x0, 0x0, 0xCA};
  15.   s[1].maByt=23.2;
  16.   s[1].DS18B20ID = {0x28, 0x19, 0x30, 0x9D, 0x1, 0x0, 0x0, 0x80};  
  17.  
  18. }
  19.  
  20. void loop() {
  21. }
  22.  
  23.  
  24. /* :
  25.  
  26. sketch_jan07b.ino: In function 'void setup()':
  27. sketch_jan07b.ino:14:21: error: cannot convert '<brace-enclosed initializer list>' to 'byte {aka unsigned char}' in assignment
  28. sketch_jan07b.ino:16:18: error: assigning to an array from an initializer list
  29. Chyba kompilace.
  30.  
  31. */
Advertisement
Add Comment
Please, Sign In to add comment