Skip to content

Instantly share code, notes, and snippets.

@elktros
Created April 11, 2016 07:06
Show Gist options
  • Save elktros/e6f4aa6fe5868ce75dc8c3a7b0f002c0 to your computer and use it in GitHub Desktop.
Save elktros/e6f4aa6fe5868ce75dc8c3a7b0f002c0 to your computer and use it in GitHub Desktop.
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);
}
@aminahmed
Copy link

Hi elktros.... can you please tell me which software you use to write those codes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment