Created
April 11, 2016 07:06
-
-
Save elktros/e6f4aa6fe5868ce75dc8c3a7b0f002c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sensorPin = A0; // select the input pin for the potentiometer | |
//int ledPin = 13; // select the pin for the LED | |
int sensorValue = 0; // variable to store the value coming from the sensor | |
void setup() { | |
// declare the ledPin as an OUTPUT: | |
Serial.begin(9600); | |
pinMode(ledPin, OUTPUT); | |
pinMode(11,OUTPUT); | |
} | |
/*void loop() { | |
// read the value from the sensor: | |
sensorValue = analogRead(sensorPin); | |
// turn the ledPin on | |
digitalWrite(ledPin, HIGH); | |
// stop the program for <sensorValue> milliseconds: | |
delay(sensorValue); | |
// turn the ledPin off: | |
digitalWrite(ledPin, LOW); | |
// stop the program for for <sensorValue> milliseconds: | |
delay(sensorValue); | |
}*/ | |
void loop() | |
{ | |
sensorValue=analogRead(sensorPin); | |
if(sensorValue <= 14) | |
digitalWrite(11,HIGH); | |
else | |
digitalWrite(11,LOW); | |
Serial.println(sensorValue); | |
delay(2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi elktros.... can you please tell me which software you use to write those codes