I have tried adding a reset of pin 54 (on the mega) like this
const int reset = 54;
void setup()
{
pinMode(reset, OUTPUT);
digitalWrite(reset, LOW);
}
void loop()
{
if (analogRead(xpin) > 589 ||analogRead(xpin) < 433||analogRead(ypin) > 589 ||analogRead(ypin) < 433 )
{
Play();
while(0);
}
else
{
#if defined(__AVR_ATmega1280__)|| defined(__AVR_ATmega2560__)
// If play/stop button is pressed during boot, enter recording.
{
delay(20);
while(0 == PSKey);
delay(20);
Record();
delay(3000);
digitalWrite(reset, HIGH);
delay(5000);
}
#endif
}}
Into here as displayed
#include <avr/io.h>
#include "config.h"
#include "filesys.h"
#include "player.h"
#include "vs10xx.h"
#include "record.h"
#include <SoftwareSerial.h>
const int groundpin = 66; // analog input pin 4 -- ground
const int powerpin = 67; // analog input pin 5 -- voltage
const int xpin = A11; // x-axis of the accelerometer
const int ypin = A10; // y-axis od the accelerometer
const int reset = 54;
SoftwareSerial mySerial(2, 3);//pin2-Rx,pin3-Tx(note: pin3 is actually later used as volume down input(not needed))
void setup()
{
Serial.begin(9600);
//Serial.println("Hello test!");
// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino.
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
pinMode(reset, OUTPUT);
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);
digitalWrite(reset, LOW);
InitSPI();
InitIOForVs10xx();
InitIOForKeys();
InitIOForLEDs();
InitFileSystem();
//VsSineTest();
Mp3Reset();
}
void loop()
{
// print the sensor values:
Serial.print(analogRead(xpin));
// print a tab between values:
Serial.print("\t");
Serial.print(analogRead(ypin));
// print a tab between values:
Serial.print("\t");
Serial.println();
/*
Set X&Y axis to light up an LED if the accelerometer tips past 30 degrees in any direction from flat.
|| means 'as well as'
< and > mean greater or less than
*/
// If the bottle tips past 30 degrees on the X or Y axis, record. If not, Playback.
if (analogRead(xpin) > 589 ||analogRead(xpin) < 433||analogRead(ypin) > 589 ||analogRead(ypin) < 433 )
{
Play();
while(0);
}
else
{
#if defined(__AVR_ATmega1280__)|| defined(__AVR_ATmega2560__)
// If play/stop button is pressed during boot, enter recording.
{
delay(20);
while(0 == PSKey);
delay(20);
Record();
delay(3000);
digitalWrite(reset, HIGH);
delay(5000);
}
#endif
}
}
but it doesn't seem to do anything.