Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<LiquidCrystal.h>
- const int analogInPin = A0; // La broche d’entrée analogique à laquelle le potentiomètre est relié
- const int analogOutPin = 9; // La broche peusdo-analogique à laquelle est reliée la LED
- int sensorValue = 0; // La valeur lue sur le potentiomètre
- int outputValue = 0; // La valeur générée sur la broche PWM
- LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
- void setup() {
- pinMode(analogInPin, INPUT);
- pinMode(analogOutPin, OUTPUT);
- Serial.begin(9600);
- lcd.begin(16, 2);
- }
- void loop() {
- sensorValue = analogRead(analogInPin);
- outputValue = map(sensorValue, 0, 1023, 0, 255);
- analogWrite(analogOutPin, outputValue);
- lcd.setCursor(0,0);
- lcd.print("SensorValue= ");
- lcd.print(sensorValue);
- lcd.setCursor(0,1);
- lcd.print("OutputValue= ");
- lcd.print(outputValue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement