How to read analog data with Arduino Uno
My next project is I want to know how analog reading is working
Material needs:
- Arduino Uno
- Potensiometer 10k Ohm.
- Jumper wire
You have to set the arduino and potensiometer as below.
Use pin A0 for analog input
Write down this sketch or you can se detail in here.
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop()
{
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
See the result data in Serial Monitor.
Klik on Tools --> Serial Monitor
Sensor value will shown in monitor.
You can use the value for reference your design.
Ensure the baud rate is 9600.
Thanks a lot
Material needs:
- Arduino Uno
- Potensiometer 10k Ohm.
- Jumper wire
You have to set the arduino and potensiometer as below.
Schematic |
Visual by arduino |
Write down this sketch or you can se detail in here.
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop()
{
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
See the result data in Serial Monitor.
Klik on Tools --> Serial Monitor
Sensor value will shown in monitor.
You can use the value for reference your design.
Ensure the baud rate is 9600.
Thanks a lot
Comments
Post a Comment