0

My MKR GSM 1400 works fine when connected to a computer (powered USB) and after opening a serial connection to it. It does not when I plug it into a power supply. My power supply is a 5V 3A with a USB adapter.

void setup() {
  // put your setup code here, to run once:
  //...
  while (!Serial);
  //...
}

void loop() {
  // put your main code here, to run repeatedly:
  //...
}
Dave X
  • 2,322
  • 13
  • 27
Mike C.
  • 103
  • 3
  • 1
    What means that it does not work? What does actually happen? Also show us your code and your circuit. Currently you don't give us enough information to help you. – chrisl Oct 04 '19 at 23:27
  • @chrisl The sketch doesn't run = It does not work. Is my power supply sufficient? Is it ok to power it through the USB connection or do I need to power it somewhere else? I don't think my code is the issue. – Mike C. Oct 05 '19 at 00:04
  • 2
    do you have `while (!Serial);` in the sketch? – Juraj Oct 05 '19 at 04:49
  • How do you see, that it doesn't run? As asked: please say, what actually happens instead of what doesn't happen. – chrisl Oct 05 '19 at 08:10
  • I’ll upload a minimal sketch later. I have an Xbee connected. The sketch makes an http request. If it were running I’d see data in the database. If I connect to the computer, it runs. I do use Serial to let me know what’s going on while connected to the computer. – Mike C. Oct 05 '19 at 10:32
  • 1
    It was the while(!serial) – Mike C. Oct 09 '19 at 17:18
  • 1
    I've posted a question with more details since I am having the same issue at: https://arduino.stackexchange.com/questions/77324/arduino-mkr-gsm-1400-fails-to-start-up-without-serial-monitor – Gineer Aug 05 '20 at 21:25

1 Answers1

5

If your sketch on an Arduino with native USB doesn't run if not connected to USB, always first check if you didn't forget to disable a dependence on Serial. A common error is a while (!Serial) {} endless loop in setup().

Dave X
  • 2,322
  • 13
  • 27
Juraj
  • 17,050
  • 4
  • 27
  • 43