The semicolon is very important. Right now you are multiplying wig
by the ScheduledTaskObject
making for a very nested and likely memory-intensive operation (in addition to giving you results you don't want).
The appropriate format of your command:
wig = {}; RunScheduledTask[(deg = temp; AppendTo[wig, deg]), {60,60}]
While we are here, I'll note that using AppendTo
can get burdensome when the amount of data being collected is large. A more efficient alternative is to use and Association
like this:
temp:=RandomVariate[NormalDistribution[60,10]] (* To simulate the temperature reading *)
wig = Association[];
RunScheduledTask[wig[Length@wig+1]=temp,{5,10}] (* I use {5,10} for demonstration here *)
When completed, wig
contains an association instead of a list; however it can still be passed to ListPlot
without a problem, and if you really want the list, you can get it with Values[wig]
The nice thing about using the Association
is that we can grab the actual time that the datapoint was collected, since it's possible that the scheduled task cannot perform the task at the desired time.
wig = Association[];
RunScheduledTask[wig[Date[]]=temp,{5,10}]
Example output is:
<|{2015,5,5,14,32,56.773218}->77.5722,{2015,5,5,14,33,1.781956}->60.4348,{2015,5,5,14,33,6.775996}->74.7136,{2015,5,5,14,33,11.784881}->54.5009,{2015,5,5,14,33,16.775621}->56.98,{2015,5,5,14,33,21.789526}->70.3364,{2015,5,5,14,33,26.775327}->84.3416,{2015,5,5,14,33,31.785066}->55.1334,{2015,5,5,14,33,36.774200}->48.3789,{2015,5,5,14,33,41.782761}->63.8248|>
and this can be plot with DateListPlot[wig]
to handle the timestamp that is being used as the key for the association.