superdave16
New member
Hi All I recently switch from using a teensy++ 2.0 to read a 0-5v variable source and trigger a relay upon certain voltage. I recently am trying to do this same thing with a TeensyLC. As I understand the analog pins are 5v Tolerant so I decided to limit voltage with a voltage divider. Before I build that I was trying to hammer down the just getting a solid low and high reading from the ADC. Now I used this sketch to get a reading
it seems 2 LC's I have used are stuck outputting a value between 300-400 but will not go to 0 when nothing connected. Same thing for a 3.3v source it stays around 150-400.
Code:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
pinMode(A0, INPUT);
}
// the loop routine runs over and over again forever:
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 / 4096.0);
// print out the value you read:
// Serial.println(voltage);
Serial.println(sensorValue);
delay(200);
}
it seems 2 LC's I have used are stuck outputting a value between 300-400 but will not go to 0 when nothing connected. Same thing for a 3.3v source it stays around 150-400.