The error is such that when I use digitalWrite() to turn on a digital pin the Arduino is not outputting The voltage it should. However, when I use an analog pin or a TWS pin and I use the analogwrite() function. The adrenal seems to be out putting much more voltage than by using a digitalWrite(). When I set the analogwrite() value to 255, which is the highest to my knowledge and LED is very bright, however, when I use the digitalwrite() the LED is very very dim. If I use the same TWS pin and use a digitalWrite() code to turn that pin on the same, happens the LEDs very dim.
This tells me it is not a hardware problem much more software problem or a coding issue or a library issue. It would be great if you can help me with this. If you follow this link to a YouTube video. This will also explain the problem very clearly.
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
analogWrite(A0,255);
analogWrite(A1,255);
analogWrite(3,255);
digitalWrite(4, HIGH);
delay(100000000);
}
Nope sorry.. problem still persists.. I have been using this board for the last two years and this problem has never occurred before..
Ideally the digital pins should be putting the same… but even the tws pins output extremely low voltages when using the digital write code.. whereas using an analog write function makes the Arduino output much higher voltages..
In the YouTube video the problem is visualised easier.. please check it out if there is any doubt with the issue… thanks
See replies 2, 6, 4 and 8. They all tell you what is wrong but you seem to be ignoring them.
You have not set the pins attached to the LEDs to be an output in your setup function. You can't generate PWM, that is use an analogWrite, on a pin that is not capable of generating a PWM signal. Check what sort of Arduino you have for a list of which the PWM pins are for your type of Arduino. They normally have a ~ (tilder) next to their PIN numbers.
You follow the rules while playing with the activation/deactivation of DPin/APin and then report the problems. if you want to write 1-bit data onto a DPin, the direction of the DPin has to made output first, That is:
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
Now, check with a DVM and observe that the reading is very close to 5V.
Now, load the pin to source about 20 mA current. Measure the voltage, you should see not less than 4.2V.
analogWrite(DPin, arg2) is only valid on DPin - 3, 11, 5, 6, 9, and 10 to produce PWM signals.