Help making sketch more efficient


i have sketch uses 3 main features:

1.  rtc module set time & timealarms library fire alarms based on time.
2.  tinysine wifi shield sitting atop uno.
3.  grove base shield v2 has co2 sensor connected via jumpers (because shield doesnt fit on tinysine wifi shield)

the sketch sets up:

1.  serial monitoring purposes (debugging far)
2.  softwareserial on 2,3 wifi shield.
3.  softwareserial on 7,8 grove shield connection.
4.  takes co2 measurement everytime alarm fires (about 1 every hour or every 2 hours).
5.  posts results web.

i believe inefficient because far, in setup i:

1.  begin serial , rtc module.
2.  set alarms.

then loop() method empty pretty much.

finally when alarm configured in setup() fires, call:

1.  printco2() prints results datareceive() call takes co2 measurement.
2.  wifistuff() initializes wifly module, logs onto network.  there wishy-washy part connects wifly serial serial.
3.  reporttocloud() opens website page, php form , posts it.

i feel uneasy because im unsure adequate chronology of events. 

originally called wifistuff() in setup , called measurement printco2() sampling code method , reporttocloud() method right after sampling code.

now im calling wifistuff() , printco2() , reporttocloud() when alarm fires.

i thinking more efficient because didnt have wifi module sitting there long time until time sample , post.  activated when time sample.  sample 12 times day means first time boots up, wifli module inactive after sample first time, wifi module sits there until next sample.

should close connection or something?

quote
i believe inefficient because
you didn't post it, , have ask post it, , wait happen...


Arduino Forum > Using Arduino > Programming Questions > Help making sketch more efficient


arduino

Comments