How I can combine these 2 codes in 1?
first code:
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress insideThermometer = { 0x28, 0x43, 0xC2, 0x03, 0x04, 0x00, 0x00, 0x85 };
void setup(void)
{
Serial.begin(9600);
sensors.begin();
sensors.setResolution(insideThermometer, 10);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print(“Error getting temperature”);
} else {
Serial.print("C: “);
Serial.print(tempC);
Serial.print(” F: ");
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}
void loop(void)
{
delay(5000);
Serial.print(“Here we go!!!..\n\r”);
sensors.requestTemperatures();
Serial.print(“The temperature is: \n\r”);
printTemperature(insideThermometer);
Serial.print("\n\r");
Serial.print(“We got it!!!\n\r”);
Serial.print("\n\r");
Serial.print("\n\r");
Serial.print("\n\r");
}
second code:
const byte ledPin = 13; // LED pin
const byte motionPin = 2; // motion detector input pin
byte senseMotion = 0; // variable to hold current state of motion detector
void setup() {
// set the digital pin directions
pinMode(ledPin, OUTPUT);
pinMode(motionPin, INPUT);
}
void loop()
{
// Now watch for burglers
senseMotion = digitalRead(motionPin);
if (senseMotion == HIGH) { // burgler found!
digitalWrite(ledPin, HIGH);
} else { // no burgler, yet…
digitalWrite(ledPin, LOW);
}
}