Hello i am using arduino to drive a Power MOSFET Photovoltaic Relay Single-Pole, Normally-Open, 0-60V, 2.0A AC / 4.0A DC where its datasheet can be seen here , and i am having trouble doing it with PWM to change the load voltage. i want to use it for a higher appliance but i tried to start out with LED because , i wanted to figure out , how it works with changing the brightness of the light. by changing PWM . from the code below you will se that the output can not be driven until the PWM is 242 and is off when the PWM is above 255 . but as the PWM gets to 242 the LED acts like active HIGH the brightness doesn't change as the PWM increases to 255 or deacreases to 242 .
how can i produce this effect ?
datsheet
Thanks
how can i produce this effect ?
datsheet
common arduino code in the examples analoginoutserial:
/*
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to
double sensorValue = 0; // value read from the pot
float outputValue = 0; // value output to the PWM (analog out)
void setup() {
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 242, 257);
outputValue+=0.5;
// change the analog out value:
analogWrite(analogOutPin,outputValue);
// print the results to the Serial Monitor:
Serial.print("sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(1000);
}