Raymond3231976
Member
thanks for the help
Last edited:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#define analogInPin A0
#define pwmOutPin 2
uint16_t sensorValue,outputValue,percentValue;
void setup() {
pinMode(pwmOutPin,OUTPUT);
pinMode(analogInPin,INPUT);
}
void loop(){
// Read the PWM value of the input potentiometer.
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// map pump speed percent of full scale
percentValue = map (outputValue, 0, 255, 0, 100);
// change the analog out value:
analogWrite(pwmOutPin, outputValue);
}
#define analogInPin A0
#define pwmOutPin 2
uint16_t sensorValue,outputValue,percentValue;
void setup() {
pinMode(pwmOutPin,OUTPUT);
pinMode(analogInPin,INPUT);
}
void loop(){
// Read the PWM value of the input potentiometer.
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// map pump speed percent of full scale
percentValue = map (outputValue, 0, 255, 0, 100);
// change the analog out value:
analogWrite(pwmOutPin, outputValue);
}