TinyZero start-up

lpcard · 4 · 9418

lpcard

  • Newbie
  • *
    • Posts: 2
    • View Profile
Hello all,

I have a project going using a TinyZero processor, combo sensor board, wireling connect board with temp/press/humidity/VOC wireling and a TinyScreen on top powered by a 290MA battery.  I have the code set up to read pressure, temperature and humidity on all three sensors (pressure and temp on the combo board, temp and humidity on the combo board, and temp, pressure and humidity on the wireling board). The display shows the internal (combo) board readings in metric units for 5 seconds, then in standard units for 5 seconds, then repeats for the external (wireling) sensor.

Everything works great, I can disconnect it from the computer and run it on the battery...until I power it off. When I turn it back on using the battery it won't boot up. Connecting it to the computer, pulling up the Arduino IDE (regardless of the sketch that appears, nothing gets downloaded) and opening the serial monitor boots it right up, and then I can disconnect it and it runs just fine on the battery.


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
Hi there,

Some of our example programs have a line like this in the setup() loop:

Code: [Select]
while(!SerialMonitor);
This line, or similar lines that do the same thing, will block the program until the Serial Monitor is opened. This will make everything seem broken when disconnected or when the code is uploaded and the serial monitor isn't open since nothing will work.

I hope that points you in the right direction for a solution. Let me know! If not, can you attach your code file(s) to a message so I can take a look at what's going on?

Thanks!
RĂ©na


lpcard

  • Newbie
  • *
    • Posts: 2
    • View Profile
Hello,

This line does indeed appear:

  SerialMonitorInterface.begin(9600);
  while(!SerialMonitorInterface);

Can this line simply be removed? What is its purpose, and what additional effects will its removal have?

Thank you very much for your assistance. I am pretty new to Arduino in general and Tiny Circuits in particular but there seems to be a lot of potential in them.

EDIT: Removing the line "while(!SerialMonitorInterface);" does indeed allow the stack to boot up and show the display without being connected, thank you. Will it have any other effects?
« Last Edit: April 20, 2022, 10:01:24 PM by lpcard »


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
No, it shouldn't have any other effects for reading the sensors. It's common to use this line for projects that include motors or moving parts since the length of time to upload the code can vary and it's not ideal to have a suddenly moving robot walking off your desk. For those cases, it's nice to have the requirement of opening the Serial Monitor before the rest of the code executes. It is used in a lot of our examples because of cases like that, but it's not always necessary.


 

SMF spam blocked by CleanTalk