Page 273 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 273
private void InitImage() {
btn_ledF.setBackgroundResource(R.drawable.ledon);
btn_PanD.setBackgroundResource(R.drawable.fanoff);
btn_PanU.setBackgroundResource(R.drawable.fanon);
btn_GasOff.setBackgroundResource(R.drawable.gasoff);
btn_GasOn.setBackgroundResource(R.drawable.gason);
btn_CtnL.setBackgroundResource(R.drawable.curtainclose);
btn_CtnR.setBackgroundResource(R.drawable.curtainopen);
btn_TurnL.setBackgroundResource(R.drawable.ctn_anticlock);
btn_TurnR.setBackgroundResource(R.drawable.ctn_clock);
btn_ledAll.setBackgroundResource(R.drawable.allon);
}
public void onClick(View v) {
//버튼이 눌리면 보낼 데이터를 data_out이라는 string에 저장해놓았다가 스레드의 스트림을 통
해서 아트메가로 전송.
if (data_out == "") {
switch (v.getId()) {
case R.id.ledR:
data_out = "c";
break;
case R.id.ledY:
data_out = "a";
break;
case R.id.Configure:
data_out = "k";
break;
case R.id.ledW:
data_out = "e";
break;
case R.id.ledG:
data_out = "d";
break;
case R.id.ledB:
data_out = "b";
break;
case R.id.ledAll:
data_out = "f";
break;
case R.id.PanUp:
data_out = "p";
- 266 -