kodi.sudar
Member level 5
- Joined
- Dec 21, 2009
- Messages
- 92
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- india
- Activity points
- 1,849
hi i am using ultrasonic distance sensor from sunrom
**broken link removed**
i tried interfacing with Arduino uno serially but when i monitor the sensor data in serial monitor window i dont find any data in that , here is my code
can any body help me sort out the problem
**broken link removed**
i tried interfacing with Arduino uno serially but when i monitor the sensor data in serial monitor window i dont find any data in that , here is my code
Code:
char sensorData[10];
int index = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
// While there is data, and we have read less than 9 characters
while(Serial.available() > 0 && index < 9)
{
char inChar = Serial.read(); // Read a character
sensorData[index] = inChar; // Store it
index++;
sensorData[index] = '\0'; // Null terminate the string
}
// Serial.print("Sensor data: ");
Serial.println(sensorData);
// Do whatever else you need to do to parse the string and use the data
index = 0;
}