Skip to content

Instantly share code, notes, and snippets.

@loadix
Created August 8, 2020 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loadix/df1f1319ed0cf3f1363a6bde3845198b to your computer and use it in GitHub Desktop.
Save loadix/df1f1319ed0cf3f1363a6bde3845198b to your computer and use it in GitHub Desktop.
//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