Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- void setup() {
- pinMode(analogInPin, INPUT);
- pinMode(analogOutPin, OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- sensorValue = analogRead(A0);
- outputValue = map(analogRead(A0), 0, 1023, 0, 255);
- analogWrite(analogOutPin, outputValue);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement