Hello, first sorry for my bad english...
I have an Arduino Mega 2560 and Arduino Software 1.0.1.
I wrote a simple program wich make the LED on pin 13 blink at differents speeds depending on the value read by an accelerometer connect on analog pin A0. I also read the accelerometer value on the Serial Monitor for double checking.
When I'm readding it, from the USB cable, it works fine, and so the arduino is powered by the USB. Then when I unplug the USB and plug an external 5V batterie on VInn(comming throught en ESC's BEC from a 11.1V LI-PO), the board is well powered, but the LED stop changing the blink speed. Of course I removed the Serial.begin(9600) so that is doesn't wait for the connexion and cause troubles... but the problem is that the card doesn't react the same way when powered by USB or VInn... I'm lost...
Here is my program if that could help somebody...
//Constante
const int CAPTEUR_PIN = 0;
int capteur;
void setup(){
//Serial.begin(9600); -- When USB pluged only
pinMode(13,OUTPUT);
}
void loop(){
capteur = analogRead(CAPTEUR_PIN);
//Serial.println(capteur); -- When USB pluged only
if((capteur > 325 && capteur < 335)){
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500);
}
else{
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,LOW);
delay(100);
}
}
I have made some test, and it seems that when Im powering the Arduino from VInn, Analog pin doesn't work anymore. With my voltmeter, I still got voltage changing at the accelerometer's output, but it seems that it is not read anymore by arduino...I'm lost !
Thanks !