HOME > 커뮤니티 > 자유게시판
창작예술공방 (불쾌지수 구름조명 소스1) 2015.10.08
postech(scienceclass@pohang.korea.com) 300

int red=9; int green=10; int blue=11; int ts=A0; int hs=A1; int tm=0; int hm=0; int para=0; void setup() { Serial.begin(9600); } void loop() { tm=analogRead(ts); hm=analogRead(hs); hm=hm*0.09766; tm=tm*0.1611328-40; para=1.8*tm-0.55*(1-hm*0.01)*(1.8*tm-26)+32; Serial.println(para); if (para>90) { analogWrite(red,255); analogWrite(green,0); analogWrite(blue,0); } else if (para<70) { analogWrite(red,0); analogWrite(green,255); analogWrite(blue,255); } else { analogWrite(red,(para-70)*12.75); analogWrite(green,(90-para)*12.75); analogWrite(blue,(90-para)*12.75); } delay(1000); }