Closed metalshreds closed 7 years ago
Hi @metalshreds ,
Thank you very much for using AWS IoT Arduino Yun SDK!
The BasicPubSub example contains statements that initialize Serial (USB to your computer) and print out messages to Serial. If you connect the board to a power adapter only, the sketch will be blocked at the Serial initialization: https://github.com/aws/aws-iot-device-sdk-arduino-yun/blob/master/AWS-IoT-Arduino-Yun-Library/examples/BasicPubSub/BasicPubSub.ino#L41
Can you try commenting out all Serial statements and try it again? Also, is there any log output that you can share when you are experiencing issues with the API?
Thanks, Liusu
Hi @metalshreds ,
I was able to duplicate your issue after I removed all Serial print-outs.
Some necessary background information:
Here's what happens when you preload the sample sketch and power cycle the board using a standalone power adapter:
To fix the issue, you will need to put delays at the beginning of your sketch (setup()
) to make sure that your sketch does not send Serial1 commands before AR9331 finishes booting up and enters OpenWRT. Like I mentioned earlier, it could take 70 seconds for OpenWRT to be ready.
Hope the above helps.
Thanks, Liusu
Thank you so much for the thorough explanation! I learned a lot today :) I commented anything related to Serial (Although maybe not necessary as you said Serial1 != Serial?), and in place of the "while(!Serial)" i added a 80 second delay to give the AR9331 time to fully boot up. After the 80 seconds the sketch takes about 20 for it to start publishing to AWS IoT, but it's all working from a power supply. Thank you!
I have a yun setup with the AWS SDK. When pushing the script through my computer, I get a Subscribe failed -1, but the arduino is still able to publish messages to AWS IoT. If I plug in the arduino to a power adapter only, nothing us pushed to AWS. I tried resetting the arduino and re-launching the script by pressing the 32U4 button twice but nothing. As soon as I launch the script from my computer it works again. Any suggestions?