Created
August 8, 2020 03:19
-
-
Save loadix/df1f1319ed0cf3f1363a6bde3845198b 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
//http://www.arduino.cc/en/Tutorial/AnalogInput | |
int sensorPin = A0; // select the input pin for the potentiometer | |
int ledPin = 9; // 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: | |
pinMode(ledPin, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
// read the value from the sensor: | |
sensorValue = analogRead(sensorPin)/4; | |
analogWrite(ledPin, sensorValue); | |
delay(1000); | |
Serial.println(sensorValue); | |
} | |
//revisar los valores en el monitor serie o monitor serial |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment