Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] Arduino reading 0x00 for 1.25v ?

Status
Not open for further replies.

Deexith Hasan

Advanced Member level 4
Joined
Oct 24, 2014
Messages
111
Helped
4
Reputation
8
Reaction score
3
Trophy points
18
Activity points
740
Arduino reading 0x00 for 1.25v? it shows 0xFF for 1.00v and again switches to 0x00 for 1.25v and starts increasing......i connected pot to 5v


Code:
/*

int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT);  
  Serial.begin(9600);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
Serial.write(sensorValue);  

  // turn the ledPin on
  digitalWrite(ledPin, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin, LOW);   
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);                  
}


but led blink rate is fine when pot is adjusted but serial port reads 0x00 for 1.25v y?
 

ernpao

Advanced Member level 4
Joined
Sep 16, 2010
Messages
100
Helped
26
Reputation
52
Reaction score
24
Trophy points
1,298
Activity points
2,043
What is your reference voltage? Remember that you are using signed int for sensorValue and that your MSB is the sign bit when you send it over the serial port, so when you send it as text, you might get something like your reading increasing from zero and then suddenly going negative. But this doesn't seem to be your problem, and I am curious why you are getting 0x00 for 1.25V (if you are using the default voltage ref on the arduino). Are you sure about your connections? Try using unsigned int for sensorValue.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top