Page 111 - MDP2022-2
P. 111
strcpy(c_t, String(t, 2).c_str());
bluetooth.write(c_t);
bluetooth.write(" ");
bluetooth.write(c_h);
Serial.println(c_h);
Serial.println(c_t);
}
void setup(){
Serial.begin(9600);
bluetooth.begin(9600);
dht.begin();
Serial.println("Start");
for(int i = 2; i < 7; i++)
pinMode(i, OUTPUT);
delay(500);
}
void loop(){
if (bluetooth.available()) {
user.command_datas[user.adr] = bluetooth.read();
Serial.write(user.command_datas[user.adr]);
user.readCommand(user.command_datas[user.adr]);
if(user.command_datas[user.adr] == 'd' || user.command_datas[user.adr] == 'D'){
user.adr = 0;
memset(user.command_datas, 0, 4);
temp_moist();
}
else user.adr++;
}
}
3. 안드로이드
로그인 화면(java)
package com.mdp.test0503;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;