View difference between Paste ID: rWgLVKhB and BcNDUvKn
SHOW: | | - or go back to the newest paste.
1
#include <VirtualWire.h>
2
3
 String wiad = "Pusto :(";
4
 
5
void setup() {
6
  Serial.begin(9600);
7
  
8
  vw_set_ptt_inverted(true);
9
  vw_setup(2000);
10
  vw_set_rx_pin(4);
11
  vw_rx_start();
12
}
13
 
14
void loop() {
15
  uint8_t odebrano[VW_MAX_MESSAGE_LEN];
16
  uint8_t dlugosc = VW_MAX_MESSAGE_LEN;
17
 
18
  if(vw_get_message(odebrano, &dlugosc)) {
19
    String wiadomosc;
20
    int i;
21
 
22
    for(i = 0; i < dlugosc; i++) {wiadomosc += char(odebrano[i]);}
23
     
24
    wiad=wiadomosc;
25
}
26-
  Serial.printl(wiad);
26+
  Serial.println(wiad);
27
  delay(100);
28
}
29
30
//Problem w tym, że na Serial Monitorze ciągle dostaję defaultową wiadomość - czyli podstawową zawartość zmiennej wiad;