In: Mechanical Engineering
2. Write a program which reads in the text file generated in
part one and writes out the same data as a comma-separated values
(CSV) file for further processing.
The file should have a header line which identifies which column
contains which values and should look something like this:
Time, Potentiometer, Temperature, Light, Switch0, Switch1, Switch2,
Switch3
That header line should be followed by detail lines containing the
measurements and should look something like this (matching the
above Arduino output):
0,1,1,1,1,0.50,0.14,0.90 40,1,1,1,1,0.65,0.20,0.89
Store the data in an appropriate struct.
Program to read text file generated in part one and write out the data as Comma Seperated Values:
type,ident,lat,long,y_proj,x_proj,new_seg,display,color,altitude,depth,temp,time,model,filename,ltime
TRACK,ACTIVE LOG,40.78966141,-77.85948515,4627251.76270444,1779451.21349775,True,False,255,358.228393554688,0,0,2008/06/11-14:08:30,eTrex Venture, ,2008/06/11 09:08:30
TRACK,ACTIVE LOG,40.78963995,-77.85954952,4627248.40489401,1779446.18060893,False,False,255,358.228393554688,0,0,2008/06/11-14:09:43,eTrex Venture, ,2008/06/11 09:09:43
TRACK,ACTIVE LOG,40.78961849,-77.85957098,4627245.69008772,1779444.78476531,False,False,255,357.747802734375,0,0,2008/06/11-14:09:44,eTrex Venture, ,2008/06/11 09:09:44
TRACK,ACTIVE LOG,40.78953266,-77.85965681,4627234.83213242,1779439.20202706,False,False,255,353.421875,0,0,2008/06/11-14:10:18,eTrex Venture, ,2008/06/11 09:10:18
TRACK,ACTIVE LOG,40.78957558,-77.85972118,4627238.65402635,1779432.89982442,False,False,255,356.786376953125,0,0,2008/06/11-14:11:57,eTrex Venture, ,2008/06/11 09:11:57
TRACK,ACTIVE LOG,40.78968287,-77.85976410,4627249.97592111,1779427.14663093,False,False,255,354.383178710938,0,0,2008/06/11-14:12:18,eTrex Venture, ,2008/06/11 09:12:18
TRACK,ACTIVE LOG,40.78979015,-77.85961390,4627264.19055204,1779437.76243578,False,False,255,351.499145507813,0,0,2008/06/11-14:12:50,eTrex Venture, ,2008/06/11 09:12:50
TRACK,ACTIVE LOG,40.78983307,-77.85961390,4627268.97701256,1779436.91622722,False,False,255,357.747802734375,0,0,2008/06/11-14:14:24,eTrex Venture, ,2008/06/11 09:14:24
TRACK,ACTIVE LOG,40.78987598,-77.85950661,4627275.37008691,1779445.16407113,False,False,255,360.151123046875,0,0,2008/06/11-14:14:35,eTrex Venture, ,2008/06/11 09:14:35
TRACK,ACTIVE LOG,40.78996181,-77.85946369,4627285.58504744,1779447.10971155,False,False,255,357.747802734375,0,0,2008/06/11-14:14:47,eTrex Venture, ,2008/06/11 09:14:47
TRACK,ACTIVE LOG,40.79011202,-77.85957098,4627300.72880585,1779435.05431356,False,False,255,350.057250976563,0,0,2008/06/11-14:15:10,eTrex Venture, ,2008/06/11 09:15:10
TRACK,ACTIVE LOG,40.79015493,-77.85954952,4627305.83572582,1779436.02722689,False,False,255,353.902587890625,0,0,2008/06/11-14:15:45,eTrex Venture, ,2008/06/11 09:15:45
TRACK,ACTIVE LOG,40.79015493,-77.85950661,4627306.47872977,1779439.66424433,False,False,255,357.747802734375,0,0,2008/06/11-14:16:21,eTrex Venture, ,2008/06/11 09:16:21
TRACK,ACTIVE LOG,40.79021931,-77.85929203,4627316.87391712,1779456.58252508,False,False,255,352.460571289063,0,0,2008/06/11-14:16:47,eTrex Venture, ,2008/06/11 09:16:47
TRACK,ACTIVE LOG,40.79024076,-77.85927057,4627319.58761408,1779457.97853529,False,False,255,352.941162109375,0,0,2008/06/11-14:16:48,eTrex Venture, ,2008/06/11 09:16:48
TRACK,ACTIVE LOG,40.79036951,-77.85907745,4627336.83984196,1779471.8086655,False,False,255,352.460571289063,0,0,2008/06/11-14:17:17,eTrex Venture, ,2008/06/11 09:17:17
TRACK,ACTIVE LOG,40.79036951,-77.85909891,4627336.51825492,1779469.98973889,False,False,255,343.327880859375,0,0,2008/06/11-14:18:13,eTrex Venture, ,2008/06/11 09:18:13
TRACK,ACTIVE LOG,40.79047680,-77.85899162,4627350.09107746,1779476.96808367,False,False,255,342.847290039063,0,0,2008/06/11-14:18:32,eTrex Venture, ,2008/06/11 09:18:32
TRACK,ACTIVE LOG,40.79064846,-77.85920620,4627366.01910842,1779455.39595965,False,False,255,346.212036132813,0,0,2008/06/11-14:18:59,eTrex Venture, ,2008/06/11 09:18:59
TRACK,ACTIVE LOG,40.79069138,-77.85922766,4627370.48398108,1779452.73079612,False,False,255,345.731323242188,0,0,2008/06/11-14:19:42,eTrex Venture, ,2008/06/11 09:19:42
TRACK,ACTIVE LOG,40.79079866,-77.85939932,4627379.87553205,1779436.06595964,False,False,255,344.77001953125,0,0,2008/06/11-14:20:14,eTrex Venture, ,2008/06/11 09:20:14
TRACK,ACTIVE LOG,40.79101324,-77.85967827,4627399.62551803,1779408.19190874,False,False,255,346.692626953125,0,0,2008/06/11-14:20:42,eTrex Venture, ,2008/06/11 09:20:42
TRACK,ACTIVE LOG,40.79101324,-77.85965681,4627399.9470929,1779410.01081578,False,False,255,346.692626953125,0,0,2008/06/11-14:21:16,eTrex Venture, ,2008/06/11 09:21:16
TRACK,ACTIVE LOG,40.79118490,-77.85987139,4627415.87524858,1779388.43897893,False,False,255,347.173217773438,0,0,2008/06/11-14:21:47,eTrex Venture, ,2008/06/11 09:21:47
TRACK,ACTIVE LOG,40.79133511,-77.86006451,4627429.7329001,1779369.10903715,False,False,255,347.653930664063,0,0,2008/06/11-14:22:05,eTrex Venture, ,2008/06/11 09:22:05
TRACK,ACTIVE LOG,40.79161406,-77.85987139,4627463.7353061,1779379.97757661,False,False,255,344.77001953125,0,0,2008/06/11-14:22:33,eTrex Venture, ,2008/06/11 09:22:33
TRACK,ACTIVE LOG,40.79172134,-77.85991430,4627475.0562103,1779374.22548807,False,False,255,343.80859375,0,0,2008/06/11-14:23:03,eTrex Venture, ,2008/06/11 09:23:03
TRACK,ACTIVE LOG,40.79172134,-77.85991430,4627475.0562103,1779374.22548807,False,False,255,340.924682617188,0,0,2008/06/11-14:23:45,eTrex Venture, ,2008/06/11 09:23:45
TRACK,ACTIVE LOG,40.79167843,-77.86004305,4627468.34161271,1779364.15903736,False,False,255,344.289428710938,0,0,2008/06/11-14:24:01,eTrex Venture, ,2008/06/11 09:24:01
TRACK,ACTIVE LOG,40.79159260,-77.86015034,4627457.16214745,1779356.75766578,False,False,255,345.731323242188,0,0,2008/06/11-14:24:17,eTrex Venture, ,2008/06/11 09:24:17
TRACK,ACTIVE LOG,40.79154968,-77.86036491,4627449.16052359,1779339.41750767,False,False,255,348.134643554688,0,0,2008/06/11-14:24:31,eTrex Venture, ,2008/06/11 09:24:31
TRACK,ACTIVE LOG,40.79169989,-77.86055803,4627463.01825969,1779320.08774845,False,False,255,349.095825195313,0,0,2008/06/11-14:24:48,eTrex Venture, ,2008/06/11 09:24:48
TRACK,ACTIVE LOG,40.79185009,-77.86075115,4627476.87491346,1779300.75825936,False,False,255,351.018432617188,0,0,2008/06/11-14:25:03,eTrex Venture, ,2008/06/11 09:25:03
TRACK,ACTIVE LOG,40.79191446,-77.86081553,4627483.08881601,1779294.03255604,False,False,255,351.979858398438,0,0,2008/06/11-14:25:26,eTrex Venture, ,2008/06/11 09:25:26
TRACK,ACTIVE LOG,40.79189301,-77.86083698,4627480.37530763,1779292.63741228,False,False,255,352.941162109375,0,0,2008/06/11-14:26:20,eTrex Venture, ,2008/06/11 09:26:20
TRACK,ACTIVE LOG,40.79169989,-77.86060095,4627462.37514912,1779316.4499767,False,False,255,350.537841796875,0,0,2008/06/11-14:26:43,eTrex Venture, ,2008/06/11 09:26:43
TRACK,ACTIVE LOG,40.79161406,-77.86045074,4627455.0541118,1779330.87351158,False,False,255,350.057250976563,0,0,2008/06/11-14:27:04,eTrex Venture, ,2008/06/11 09:27:04
TRACK,ACTIVE LOG,40.79159260,-77.86045074,4627452.66088714,1779331.29660567,False,False,255,350.057250976563,0,0,2008/06/11-14:27:06,eTrex Venture, ,2008/06/11 09:27:06
TRACK,ACTIVE LOG,40.79135656,-77.86012888,4627431.16046351,1779363.23028903,False,False,255,347.173217773438,0,0,2008/06/11-14:27:32,eTrex Venture, ,2008/06/11 09:27:32
TRACK,ACTIVE LOG,40.79112053,-77.85982847,4627409.33982599,1779393.34591179,False,False,255,346.212036132813,0,0,2008/06/11-14:27:57,eTrex Venture, ,2008/06/11 09:27:57
TRACK,ACTIVE LOG,40.79086304,-77.85950661,4627385.44746832,1779425.70289218,False,False,255,345.250610351563,0,0,2008/06/11-14:28:24,eTrex Venture, ,2008/06/11 09:28:24
TRACK,ACTIVE LOG,40.79075575,-77.85935640,4627375.73335314,1779440.5498292,False,False,255,345.731323242188,0,0,2008/06/11-14:28:44,eTrex Venture, ,2008/06/11 09:28:44
TRACK,ACTIVE LOG,40.79051971,-77.85905600,4627353.91165485,1779470.6652577,False,False,255,346.212036132813,0,0,2008/06/11-14:29:10,eTrex Venture, ,2008/06/11 09:29:10
TRACK,ACTIVE LOG,40.79045534,-77.85894871,4627348.34087781,1779481.02821242,False,False,255,348.134643554688,0,0,2008/06/11-14:29:35,eTrex Venture, ,2008/06/11 09:29:35
TRACK,ACTIVE LOG,40.79045534,-77.85894871,4627348.34087781,1779481.02821242,False,False,255,352.941162109375,0,0,2008/06/11-14:29:53,eTrex Venture, ,2008/06/11 09:29:53
TRACK,ACTIVE LOG,40.79032660,-77.85877705,4627336.55616698,1779498.11631935,False,False,255,349.095825195313,0,0,2008/06/11-14:30:29,eTrex Venture, ,2008/06/11 09:30:29
TRACK,ACTIVE LOG,40.79017639,-77.85858393,4627322.69873444,1779517.44674923,False,False,255,350.057250976563,0,0,2008/06/11-14:30:55,eTrex Venture, ,2008/06/11 09:30:55
TRACK,ACTIVE LOG,40.79019785,-77.85862684,4627324.44891961,1779513.3865948,False,False,255,352.941162109375,0,0,2008/06/11-14:31:34,eTrex Venture, ,2008/06/11 09:31:34
TRACK,ACTIVE LOG,40.79034805,-77.85881996,4627338.3052446,1779494.05637582,False,False,255,351.979858398438,0,0,2008/06/11-14:31:55,eTrex Venture, ,2008/06/11 09:31:55
TRACK,ACTIVE LOG,40.79024076,-77.85903454,4627323.12460431,1779477.98422633,False,False,255,350.537841796875,0,0,2008/06/11-14:32:17,eTrex Venture, ,2008/06/11 09:32:17
TRACK,ACTIVE LOG,40.79021931,-77.85905600,4627320.41090176,1779476.58822285,False,False,255,350.057250976563,0,0,2008/06/11-14:32:25,eTrex Venture, ,2008/06/11 09:32:25
TRACK,ACTIVE LOG,40.79024076,-77.85905600,4627322.80301647,1779476.16529588,False,False,255,351.499145507813,0,0,2008/06/11-14:32:54,eTrex Venture, ,2008/06/11 09:32:54
TRACK,ACTIVE LOG,40.79021931,-77.85905600,4627320.41090176,1779476.58822285,False,False,255,350.537841796875,0,0,2008/06/11-14:33:14,eTrex Venture, ,2008/06/11 09:33:14
TRACK,ACTIVE LOG,40.79015493,-77.85914183,4627311.94501541,1779470.5827101,False,False,255,351.979858398438,0,0,2008/06/11-14:33:33,eTrex Venture, ,2008/06/11 09:33:33
TRACK,ACTIVE LOG,40.79002619,-77.85931349,4627295.01549676,1779458.57124095,False,False,255,351.979858398438,0,0,2008/06/11-14:33:54,eTrex Venture, ,2008/06/11 09:33:54
TRACK,ACTIVE LOG,40.78987598,-77.85952806,4627275.04865997,1779443.34597797,False,False,255,353.902587890625,0,0,2008/06/11-14:34:20,eTrex Venture, ,2008/06/11 09:34:20
TRACK,ACTIVE LOG,40.78966141,-77.85972118,4627248.22583359,1779431.2076234,False,False,255,352.460571289063,0,0,2008/06/11-14:34:39,eTrex Venture, ,2008/06/11 09:34:39
TRACK,ACTIVE LOG,40.78959703,-77.85957098,4627243.29685689,1779445.2078692,False,False,255,352.941162109375,0,0,2008/06/11-14:35:00,eTrex Venture, ,2008/06/11 09:35:00
TRACK,ACTIVE LOG,40.78966141,-77.85950661,4627251.44112745,1779449.39455063,False,False,255,352.941162109375,0,0,2008/06/11-14:35:40,eTrex Venture, ,2008/06/11 09:35:40