#include
IRsend irsend;
void setup()
{
Serial.begin(115200);
pinMode (A0, INPUT);
pinMode (13, OUTPUT);
}
void loop()
{
while (Serial.available() == 0);
int pr = analogRead(A0);
int val = Serial.read();
if (val == 81) {
irsend.sendNEC( 0x1067A857, 32 );
Serial.println( "NeoSaid: Received Q." );
} else if (val == 87) {
irsend.sendNEC( 0x1067A857, 32 );
Serial.println( "NeoSaid: Received W." );
} else if (val == 69) {
Serial.println(pr);
if (pr > 700) {
Serial.println( "NeoSaid: Light Up." );
} else {
Serial.println( "NeoSaid: Light Down." );
}
Serial.println( "NeoSaid: Received E." );
} else {
Serial.println( "NeoSaid: Nothing found!!!" );
}
//Serial.println(val);
}
2016-11-24
Arduino, Light Sensor.
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言