Нужна помощь

нужна помощь делаю проект племяшке

Беспроводная сигнализация на базе Arduino
не могу загрузить скетч из за ошибки компиляции заранее спасибо

01 // Include VirtualWire library
02 #include <VirtualWire.h>
03

04 int led_pin = 13;
05 int transmit_pin = 12;
06 int pir_pin = 2;
07 int val = 0;
08 int pir_state = LOW;
09

10 void setup()
11 {
12 Serial.begin(9600);
13 vw_set_tx_pin(transmit_pin);
14 vw_setup(4000); // Transmission rate
15 pinMode(led_pin, OUTPUT);
16 pinMode(pir_pin,INPUT);
17 }
18
19 void loop()
20 {
21 char msg[1] = {'0'};
22 // Get sensor value
23 val = digitalRead(pir_pin);
24 // Change message if motion is detected
25 if (val == 1)
26 {
27 msg[0] = '1';

28 digitalWrite(led_pin, HIGH); // Flash a light to show transmitting

29 vw_send((uint8_t *)msg, 1);

30
vw_wait_tx(); // Wait until the whole message is gone
31
if (pir_state == LOW)
32
{
33
Serial.println("Motion detected!");
34
pir_state = HIGH;
35
}
36
}
37
else
38
{
39
msg[0] = '0';
40
digitalWrite(led_pin, LOW);
41
vw_send((uint8_t *)msg, 1);
42
vw_wait_tx(); // Wait until the whole message is gone
43
if (pir_state == HIGH)
44
{
45
Serial.println("Motion ended!");
46
pir_state = LOW;
47
}
48
}
49
}
и

кодрасечатать?
01
// Include VirtualWire library
02
#include <VirtualWire.h>
03

04
// Pins definition
05
const int led_pin = 13;
06
const int receive_pin = 12;
07
int pinSpeaker = 10;
08

09
void setup()
10
{
11
Serial.begin(9600); // Debugging only
12
// Initialise the IO and ISR
13
vw_set_rx_pin(receive_pin);
14
vw_setup(4000); // Transmission rate
15
// Start the receiver PLL
16
vw_rx_start();
17
// Set LED pin and Buzzer
18
pinMode(led_pin, OUTPUT);
19
pinMode(pinSpeaker, OUTPUT);
20
}
21

22
void loop()
23
{
24
uint8_t buf[VW_MAX_MESSAGE_LEN];
25
uint8_t buflen = VW_MAX_MESSAGE_LEN;
26

27
// Check if a message was received
28
if (vw_get_message(buf, &buflen))
29
{
30
if(buf[0]=='1')
31
{
32
Serial.println("Motion detected!");
33
digitalWrite(led_pin,1);
34
playTone(300, 160);
35
delay(150);
36
}
37
if(buf[0]=='0')
38
{
39
Serial.println("Motion ended!");
40
digitalWrite(led_pin,0);
41
playTone(0, 0);
42
delay(300);
43
}
44
}
45
}
46

47
// duration in mSecs, frequency in hertz
48
void playTone(long duration, int freq)
49
{
50
duration *= 1000;
51
int period = (1.0 / freq) * 1000000;
52
long elapsed_time = 0;
53
while (elapsed_time < duration)
54
{
55
digitalWrite(pinSpeaker,HIGH);
56
delayMicroseconds(period / 2);
57
digitalWrite(pinSpeaker, LOW);
58
delayMicroseconds(period / 2);
59
elapsed_time += (period);
60
}
61
}