| Arduino Forum ::  Members :: grapie
 Show Posts Pages: [1]
 1 Using Arduino / Project Guidance / Calculating acceleration and velocity using accelerometer on: March 25, 2011, 09:45:48 pm Hi guys, i am designing a project using an accelerometer and some sensors to determine the speed of an oncoming vehicle and the speed at which i am traveling to determine whether its safe to overtake, however i have tested my code and my velocity gives me negative values and from time to time my accelerations does so too; can anyone help me spot this error please.#include "Acc_Module.h"#include "WProgram.h"ACC::ACC(int x , int y){   xPin = x;   yPin = y;    time = micros();      pinMode(xPin,INPUT);   pinMode (yPin,INPUT); }//convert time to accelerationdouble ACC:: accel(){   pulX = pulseIn (xPin, HIGH);   accelerationX ((pulX / 10) - 500) * /100;  return accelerationX;     }//convert acceleration to velocitydouble ACC::velocityX(){  double velX = (accel()*pulX)/1000000;  return velX;}//convert time to distancedouble ACC:: distance_behind(){  distance = (velocityX()*pulX)/1000000;  return distance;}
 2 General Category / General Discussion / response system on: March 03, 2011, 04:08:37 pm Hi everyone, i am new to arduino and new to the forum. i am doing a project that requires me to use an arduino uno board along with an accelerometer and some sensors to determine whether its safe to over take the  vehicle  in front depending on several things like the speed at which you are travelling, the speed of the oncoming vehicle and the speed of the vehicle immediately in front.  However i am a bit in a tango as to the algorithm i should take could someone please give me a suitable algorithm to ease this confusion. Also a few l.e.d's will come into play for safe signalling.
 Pages: [1]