Stap 2: zender
Zender is zeer eenvoudig. Sluit de draden zoals afgebeeld in foto's.
Hier is de code zender:
#include < VirtualWire.h >
#include < OneWire.h >
#include < DallasTemperature.h >
#define ONE_WIRE_BUS 7
Privacy oneWire(ONE_WIRE_BUS);
DallasTemperature sensoren (& Privacy);
char msg [6];
VOID Setup {}
sensors.begin();
vw_setup(2000);
vw_set_tx_pin(3);
}
void loop {}
sensors.requestTemperatures();
zweven temperatuur = sensors.getTempCByIndex(0);
dtostrf (temperatuur, 6, 2, msg);
vw_send ((uint8_t *) msg, strlen(msg));
vw_wait_tx();
delay(200);
}