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:
  //...
}
7
  • 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 4, 2019 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 5, 2019 at 0:04
  • 2
    do you have while (!Serial); in the sketch?
    – Juraj
    Oct 5, 2019 at 4:49
  • 1
    It was the while(!serial)
    – Mike C.
    Oct 9, 2019 at 17:18
  • 1
    I've posted a question with more details since I am having the same issue at: arduino.stackexchange.com/questions/77324/…
    – Gineer
    Aug 5, 2020 at 21:25

1 Answer 1

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().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.