#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.
2016-11-21
2016-11-09
2016-11-01
Arduino, LED
int ledPin_Red = 12;
int ledPin_Green = 11;
int ledPin_Yellow = 10;
void setup()
{
pinMode(ledPin_Red, OUTPUT);
pinMode(ledPin_Green, OUTPUT);
pinMode(ledPin_Yellow, OUTPUT);
}
void loop()
{
digitalWrite(ledPin_Red, HIGH);
delay(100);
digitalWrite(ledPin_Green, HIGH);
delay(100);
digitalWrite(ledPin_Yellow, HIGH);
delay(100);
digitalWrite(ledPin_Red, LOW);
delay(100);
digitalWrite(ledPin_Green, LOW);
delay(100);
digitalWrite(ledPin_Yellow, LOW);
delay(100);
}
訂閱:
文章 (Atom)