I want to reset the analog accelerometer in order to go back to its normal mode operation or in its function...
I know that there is a reset connection in my microcontroller Arduino UNO... I put a jumper wire in the analog pin_2 and it is connected into RESET...
my problem is I did'nt get the correct way of coding... I want to reset it but it did'nt... I want to program the "reset" instead of using pushbutton reset in Arduino UNO...
Is it possible to make this program??? please give me a hint or idea on how to do it....
const int buttonPin = A1; // analog input pin 1
const int groundpin = 18; // analog input pin 4 -- ground
const int powerpin = 19; // analog input pin 5 -- voltage
int xpin = A3; // x-axis of the accelerometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);
}
void loop()
{
sensorValue = digitalRead(A1);
if (sensorValue == HIGH){
sensorValue = analogRead(xpin);
Serial.print(analogRead(xpin));
Serial.print("\t");
Serial.println();
}
else{
if (sensorValue == LOW){
analogWrite(A5, LOW);
}
else{
if (sensorValue == HIGH){
analogWrite(A2, LOW);
}
else{
analogWrite(A2, HIGH);
}
}
}
delay(500);
}