Hello. Today I began doing some Arduino projects (I love it thus far!) and it went well. However, during project 3, one of my LEDs doesn't glow much. I'll post the code, hopefully that will help you understand my issue.
Basically, the OUTPUT port 3 LED won't glow much. I feel that there is not enough voltage or something. Even if I try without a resistor, it barely glows.
So, question 1: Do you know why it (the output 3 port) doesn't glow? I don't think it's a code issue. ||EDIT|| I just noticed that the output port 3 is reserved for PMW. Could this perhaps explain why it glows so vaguely? If this is the case, can I change it to a static 5V output?
Question 2: The temperature sensor (TMP36) feels sort of dull.. I have to press it hard for it to increase it's temperature, almost too hard. I know it's not high-tech but still, I have nothing to compare it with. Should it be smoother or is it working as intended?
That appears to be a bad LED. Did you try swapping it with another one?
Output port 3 will only do PWM with an analogWrite() command. You are using digitalWrite() commands so PWM does not apply here.
You have the baselineTempt is set high (28.7 C). Unless it's very warm where you are, that could be why you have a harder time increasing the temperature. The baselineTempt should be changed to your local room temperature.
There is nothing wrong with the LED, I tried 7-8 different ones.
As for my baselineTempt, I set it to the temperature that my sensor measured. Of course my room temperature is not 28.7 C, but if I set the baselineTempt to 22 C or so, it would pretty much always stay in the same mode.
It may be a possibility that your output port 3 is damaged. It can happen by drawing too much current from a port. LEDs should always be used with at least a 220 Ohm or greater resistor. You should avoid using it directly to a port. This could cause a port to burn out. Depending on the type and color of an LED the resistance can vary a bit. I typically try to use at least a 1K Ohm resistor to be safe. We may want to try some other experiments to test if your port is working correctly or not.
As for the TMP36, make sure you have the +5V and GND connections correct. With the TMP36 "flat-side" facing you, the power +5V should be on the left pin-1, the middle pin-2 is always the signal going to the analog input on the Arduino, the ground GND should be on the right pin-3.