Hello, in designing my project i have ran into a problem with an output pin. It will only give me 12mV. This is just testing to add to the main code, ultimately it will fill a bottle with water after a potentiometer reaches a certain level and cut off at another. As well, it will sound an alarm if it reaches to low. The potentiometer is a 10Kohm slide, as for now I'm trying to get it to light up two resistors. The code I am using now:
int MotorPin = 13;
int LedLOW = 12;
int voltage;
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(MotorPin, OUTPUT);
pinMode(LedLOW, OUTPUT);
}
void loop()
{
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:]
Serial.println (voltage);
if ( voltage > 4.5 )
{
digitalWrite(MotorPin, HIGH);
digitalWrite(LedLOW , HIGH);
}
else if (voltage < 4.5 && voltage > 2)
{
digitalWrite(MotorPin , HIGH);
digitalWrite(LedLOW, LOW);
}
else (voltage <=2);
{
digitalWrite(MotorPin , LOW);
digitalWrite(LedLOW, LOW);
}
}
I think it is somewhere in the code. i could be wrong, relatively new to programming. Ultimately this arduino is the "emperor" one pic16f88 "master" and 2 other pic16f88 are "slaves".
Thanks for your time.
