I am using an Arduino uno rev.3 with a seeedrelay shed v1.3
connected via usb cable (
i currently have wires in pin d9, A0, 5v and a ground on both the anolog side and the digital side. all tucked in with the relay shed pins.
this is the code I am working on, using a multimeter to test voltage. I noticed pin 9 when set to 0 still has 3.4mv I checked the other pins and they also have low mv on them as well pin 9 does come up to 1.502v when set to 75.
Is it normal to have 3.4mv when pin is set to Low or 0?
int photoRPin = 0;
int minLight;
int maxLight;
int lightLevel;
int adjustedLightLevel;
int x;
int ignitorPin = 9; // Ignitor assined to pin 9
void setup() {
Serial.begin(9600);
pinMode(ignitorPin, OUTPUT); // sets the pin 9 as output to ignitor
//Setup the starting light level limits
lightLevel=analogRead(photoRPin);
minLight=lightLevel-20;
maxLight=lightLevel;
}
void loop(){
//auto-adjust the minimum and maximum limits in real time
lightLevel=analogRead(photoRPin);
//if(minLight>lightLevel){
//minLight=lightLevel;
//}
//if(maxLight<lightLevel){
//maxLight=lightLevel;
//}
//Adjust the light level to produce a result between 0 and 100.
//adjustedLightLevel = map(lightLevel, minLight, maxLight, 0, 100);
x = lightLevel;
//Send the adjusted Light level result to Serial port (processing)
if(lightLevel<=120)
{
Serial.print("light should be on");
Serial.print(x);
Serial.println();
analogWrite(ignitorPin,75); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 this should be 1.5v on pin 9
}
if(lightLevel>=120)
{
Serial.print("Light should be off");
Serial.print(x);
Serial.println();
analogWrite(ignitorPin,0); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 this should be 0.0v on pin 9
}
//Serial.println(adjustedLightLevel);
//slow down the transmission for effective Serial communication.
delay(5000);
}