In this example, we are interfacing Accelerometer ADXL 335 to Arduino Mega through ADC pins and plotting the values using the ROS tool called rqt_plot.
The following image shows the circuit of the connection between ADLX 335 and Arduino::
The ADLX 335 is an analog accelerometer. We can simply connect to the ADC port and read the digital value. Following is the embedded code to interface ADLX 335 via Arduino ADC:
#if (ARDUINO >= 100) #include <Arduino.h> #else #include <WProgram.h> #endif #include <ros.h> #include <rosserial_arduino/Adc.h> const ...