Need Help With TeensyLC

Status
Not open for further replies.

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
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.
 
Your sketch worked for me (though you don't really need pinMode(A0, INPUT), harmless). if i jumper LC's 3.3v to A0 it reports 1023. if i jumper A0 to GND it reports 1. If A0 is unconnected you get "random numbers". I used delay(1000);

You have a conflicting statement: "As I understand the analog pins are 5v Tolerant so I decided to limit voltage with a voltage divider.". LC is NOT 5v tolerant, if you have accidentally connected A0 to 5v you may have damaged your LC. But you seem to realize you need a voltage divider if your input is 5v.

It seems like your A0 is not connected ?? bad solder? wrong pin? A0 is pin 14. attach photo of your LC setup ?
 
Last edited:
Status
Not open for further replies.
Back
Top