(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 10.2' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 19127, 419] NotebookOptionsPosition[ 18739, 401] NotebookOutlinePosition[ 19079, 416] CellTagsIndexPosition[ 19036, 413] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"uno", "=", RowBox[{"DeviceOpen", "[", RowBox[{"\"\\"", ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"\"\\"", "\[Rule]", "9600"}]}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{ TagBox["DeviceObject", "SummaryHead"], "[", DynamicModuleBox[{Typeset`open$$ = False}, PanelBox[ PaneSelectorBox[{False->GridBox[{ { PaneBox[ ButtonBox[ DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "SquarePlusIconMedium"], ImageSizeCache->{12., {0., 12.}}], Appearance->None, ButtonFunction:>(Typeset`open$$ = True), Evaluator->Automatic, Method->"Preemptive"], Alignment->{Center, Center}, ImageSize-> Dynamic[{ Automatic, 3.5 CurrentValue["FontCapHeight"]/AbsoluteCurrentValue[ Magnification]}]], GraphicsBox[ {Thickness[0.038461538461538464`], {FaceForm[{RGBColor[0.941, 0.961, 0.957], Opacity[1.]}], FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395, 0.5}, { 0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}}]}, {RGBColor[0.7, 0.7, 0.7], Opacity[1.], JoinForm[{"Miter", 10.}], JoinedCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395, 0.5}, { 0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}}, CurveClosed->{1}]}, {FaceForm[{RGBColor[0.5423, 0.63104, 0.63597], Opacity[1.]}], FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{11.133, 18.727999999999998`}, {11.133, 18.451999999999998`}, { 11.357000000000001`, 18.227999999999998`}, {11.633, 18.227999999999998`}, {14.792, 18.227999999999998`}, {15.068, 18.227999999999998`}, {15.292, 18.451999999999998`}, {15.292, 18.727999999999998`}, {15.292, 20.639000000000003`}, {15.292, 20.915}, {15.068, 21.139000000000003`}, {14.792, 21.139000000000003`}, {11.633, 21.139000000000003`}, { 11.357000000000001`, 21.139000000000003`}, {11.133, 20.915}, { 11.133, 20.639000000000003`}, {11.133, 18.727999999999998`}}}]}, {FaceForm[{RGBColor[0.5, 0.5, 0.5], Opacity[1.]}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{ 12.357000000000001`, 1.}, {14.113000000000001`, 1.}, { 14.113000000000001`, 9.554}, {12.357000000000001`, 9.554}}}]}, {FaceForm[{RGBColor[0.624375, 0.695304, 0.691308], Opacity[1.]}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{15.876000000000001`, 19.799}, {8.122, 19.799}, { 8.122, 11.516}, {10.573, 11.516}, {10.573, 11.493}, { 11.982000000000001`, 9.171}, {14.539, 9.171}, { 15.876000000000001`, 11.493}, {15.876000000000001`, 11.516}, { 18.326, 11.516}, {18.326, 19.799}, {15.876000000000001`, 19.799}}}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{ 8.806000000000001, 7.993}, {9.995000000000001, 7.993}, { 9.995000000000001, 11.008}, {8.806000000000001, 11.008}}}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{16.5, 7.993}, {17.689, 7.993}, {17.689, 11.008}, {16.5, 11.008}}}]}}, AspectRatio->Automatic, ImageSize->{Automatic, Dynamic[3.5 CurrentValue["FontCapHeight"]]}, PlotRange->{{0., 26.}, {0., 26.}}], GridBox[{ { RowBox[{ TagBox["\<\"Class: \"\>", "SummaryItemAnnotation"], "\[InvisibleSpace]", TagBox["\<\"Serial\"\>", "SummaryItem"]}], RowBox[{ TagBox["\<\"ID: \"\>", "SummaryItemAnnotation"], "\[InvisibleSpace]", TagBox["1", "SummaryItem"]}]}, { RowBox[{ TagBox["\<\"Status: \"\>", "SummaryItemAnnotation"], "\[InvisibleSpace]", TagBox[ DynamicModuleBox[{Devices`DeviceAPI`DeviceDump`lights$$ = { Style[ Graphics[{{ RGBColor[0.88, 1, 0.88], Disk[{0, 0}]}, { RGBColor[0, 0.85, 0], Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize -> 9, ImageMargins -> {{3, 3}, {2, 0}}, BaseStyle -> {CacheGraphics -> False}], Selectable -> False], Style[ Graphics[{{ RGBColor[1, 1, 0], Disk[{0, 0}]}, { RGBColor[0.8, 0.8, 0], Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize -> 9, ImageMargins -> {{3, 3}, {2, 0}}, BaseStyle -> {CacheGraphics -> False}], Selectable -> False]}, Devices`DeviceAPI`DeviceDump`opacities$$ = { Opacity[1], Opacity[0.2]}, Devices`DeviceAPI`DeviceDump`status$$ = { "Connected (COM8)", "Not connected (COM8)"}, Devices`DeviceAPI`DeviceDump`d$$ = DeviceObject[{"Serial", 1}], Devices`DeviceAPI`DeviceDump`ind$$ = 2, Devices`DeviceAPI`DeviceDump`indr$$ = 2}, DynamicBox[ToBoxes[Devices`DeviceAPI`DeviceDump`ind$$ = If[ DeviceOpenQ[Devices`DeviceAPI`DeviceDump`d$$], 1, 2]; Devices`DeviceAPI`DeviceDump`indr$$ = If[ DeviceFramework`DeviceRegisteredQ[ Devices`DeviceAPI`DeviceDump`d$$], 1, 2]; Style[ Row[{ Part[ Devices`DeviceAPI`DeviceDump`lights$$, Devices`DeviceAPI`DeviceDump`ind$$], Part[ Devices`DeviceAPI`DeviceDump`status$$, Devices`DeviceAPI`DeviceDump`ind$$]}], Part[ Devices`DeviceAPI`DeviceDump`opacities$$, Devices`DeviceAPI`DeviceDump`indr$$]], StandardForm], ImageSizeCache->{168., {5., 11.}}], DynamicModuleValues:>{}], "SummaryItem"]}], "\[SpanFromLeft]"} }, AutoDelete->False, BaseStyle->{ ShowStringCharacters -> False, NumberMarks -> False, PrintPrecision -> 3, ShowSyntaxStyles -> False}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{2}}, "Rows" -> {{Automatic}}}]} }, AutoDelete->False, BaselinePosition->{1, 1}, GridBoxAlignment->{"Rows" -> {{Top}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], True->GridBox[{ { PaneBox[ ButtonBox[ DynamicBox[FEPrivate`FrontEndResource[ "FEBitmaps", "SquareMinusIconMedium"]], Appearance->None, ButtonFunction:>(Typeset`open$$ = False), Evaluator->Automatic, Method->"Preemptive"], Alignment->{Center, Center}, ImageSize-> Dynamic[{ Automatic, 3.5 CurrentValue["FontCapHeight"]/AbsoluteCurrentValue[ Magnification]}]], GraphicsBox[ {Thickness[0.038461538461538464`], {FaceForm[{RGBColor[0.941, 0.961, 0.957], Opacity[1.]}], FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395, 0.5}, { 0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}}]}, {RGBColor[0.7, 0.7, 0.7], Opacity[1.], JoinForm[{"Miter", 10.}], JoinedCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{25.5, 2.5}, {25.5, 1.395}, {24.605, 0.5}, {23.5, 0.5}, {2.5, 0.5}, {1.395, 0.5}, { 0.5, 1.395}, {0.5, 2.5}, {0.5, 23.5}, {0.5, 24.605}, {1.395, 25.5}, {2.5, 25.5}, {23.5, 25.5}, {24.605, 25.5}, {25.5, 24.605}, {25.5, 23.5}, {25.5, 2.5}}}, CurveClosed->{1}]}, {FaceForm[{RGBColor[0.5423, 0.63104, 0.63597], Opacity[1.]}], FilledCurveBox[{{{1, 4, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}, {1, 3, 3}, {0, 1, 0}}}, {{{11.133, 18.727999999999998`}, {11.133, 18.451999999999998`}, { 11.357000000000001`, 18.227999999999998`}, {11.633, 18.227999999999998`}, {14.792, 18.227999999999998`}, {15.068, 18.227999999999998`}, {15.292, 18.451999999999998`}, {15.292, 18.727999999999998`}, {15.292, 20.639000000000003`}, {15.292, 20.915}, {15.068, 21.139000000000003`}, {14.792, 21.139000000000003`}, {11.633, 21.139000000000003`}, { 11.357000000000001`, 21.139000000000003`}, {11.133, 20.915}, { 11.133, 20.639000000000003`}, {11.133, 18.727999999999998`}}}]}, {FaceForm[{RGBColor[0.5, 0.5, 0.5], Opacity[1.]}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{ 12.357000000000001`, 1.}, {14.113000000000001`, 1.}, { 14.113000000000001`, 9.554}, {12.357000000000001`, 9.554}}}]}, {FaceForm[{RGBColor[0.624375, 0.695304, 0.691308], Opacity[1.]}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{15.876000000000001`, 19.799}, {8.122, 19.799}, { 8.122, 11.516}, {10.573, 11.516}, {10.573, 11.493}, { 11.982000000000001`, 9.171}, {14.539, 9.171}, { 15.876000000000001`, 11.493}, {15.876000000000001`, 11.516}, { 18.326, 11.516}, {18.326, 19.799}, {15.876000000000001`, 19.799}}}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{ 8.806000000000001, 7.993}, {9.995000000000001, 7.993}, { 9.995000000000001, 11.008}, {8.806000000000001, 11.008}}}], FilledCurveBox[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{16.5, 7.993}, {17.689, 7.993}, {17.689, 11.008}, {16.5, 11.008}}}]}}, AspectRatio->Automatic, ImageSize->{Automatic, Dynamic[3.5 CurrentValue["FontCapHeight"]]}, PlotRange->{{0., 26.}, {0., 26.}}], GridBox[{ { RowBox[{ TagBox["\<\"Class: \"\>", "SummaryItemAnnotation"], "\[InvisibleSpace]", TagBox["\<\"Serial\"\>", "SummaryItem"]}], RowBox[{ TagBox["\<\"ID: \"\>", "SummaryItemAnnotation"], "\[InvisibleSpace]", TagBox["1", "SummaryItem"]}]}, { RowBox[{ TagBox["\<\"Status: \"\>", "SummaryItemAnnotation"], "\[InvisibleSpace]", TagBox[ DynamicModuleBox[{Devices`DeviceAPI`DeviceDump`lights$$ = { Style[ Graphics[{{ RGBColor[0.88, 1, 0.88], Disk[{0, 0}]}, { RGBColor[0, 0.85, 0], Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize -> 9, ImageMargins -> {{3, 3}, {2, 0}}, BaseStyle -> {CacheGraphics -> False}], Selectable -> False], Style[ Graphics[{{ RGBColor[1, 1, 0], Disk[{0, 0}]}, { RGBColor[0.8, 0.8, 0], Circle[{0, 0}]}}, PlotRange -> {-2.2, 1.1}, ImageSize -> 9, ImageMargins -> {{3, 3}, {2, 0}}, BaseStyle -> {CacheGraphics -> False}], Selectable -> False]}, Devices`DeviceAPI`DeviceDump`opacities$$ = { Opacity[1], Opacity[0.2]}, Devices`DeviceAPI`DeviceDump`status$$ = { "Connected (COM8)", "Not connected (COM8)"}, Devices`DeviceAPI`DeviceDump`d$$ = DeviceObject[{"Serial", 1}], Devices`DeviceAPI`DeviceDump`ind$$, Devices`DeviceAPI`DeviceDump`indr$$}, DynamicBox[ToBoxes[Devices`DeviceAPI`DeviceDump`ind$$ = If[ DeviceOpenQ[Devices`DeviceAPI`DeviceDump`d$$], 1, 2]; Devices`DeviceAPI`DeviceDump`indr$$ = If[ DeviceFramework`DeviceRegisteredQ[ Devices`DeviceAPI`DeviceDump`d$$], 1, 2]; Style[ Row[{ Part[ Devices`DeviceAPI`DeviceDump`lights$$, Devices`DeviceAPI`DeviceDump`ind$$], Part[ Devices`DeviceAPI`DeviceDump`status$$, Devices`DeviceAPI`DeviceDump`ind$$]}], Part[ Devices`DeviceAPI`DeviceDump`opacities$$, Devices`DeviceAPI`DeviceDump`indr$$]], StandardForm]], DynamicModuleValues:>{}], "SummaryItem"]}], "\[SpanFromLeft]"}, { TagBox[ DynamicModuleBox[{Devices`DeviceAPI`DeviceDump`opacities$$ = { Opacity[1], Opacity[0.2]}, Devices`DeviceAPI`DeviceDump`d$$ = DeviceObject[{"Serial", 1}], Devices`DeviceAPI`DeviceDump`props$$, Devices`DeviceAPI`DeviceDump`vals$$, Devices`DeviceAPI`DeviceDump`reg$$}, DynamicBox[ToBoxes[ Devices`DeviceAPI`DeviceDump`reg$$ = DeviceFramework`DeviceRegisteredQ[ Devices`DeviceAPI`DeviceDump`d$$]; Devices`DeviceAPI`DeviceDump`props$$ = DeviceFramework`DeviceExternalProperties[ Devices`DeviceAPI`DeviceDump`d$$]; Devices`DeviceAPI`DeviceDump`vals$$ = Devices`DeviceAPI`DeviceDump`d$$[ Devices`DeviceAPI`DeviceDump`props$$]; Column[ Join[{ BoxForm`SummaryItem[{"Properties: ", If[ Or[ Not[Devices`DeviceAPI`DeviceDump`reg$$], Devices`DeviceAPI`DeviceDump`props$$ === {}], Style[None, Part[Devices`DeviceAPI`DeviceDump`opacities$$, If[Devices`DeviceAPI`DeviceDump`reg$$, 1, 2]]], ""]}]}, MapThread[BoxForm`SummaryItem[{ StringJoin[" ", ToString[#], ": "], #2}]& , { Devices`DeviceAPI`DeviceDump`props$$, Devices`DeviceAPI`DeviceDump`vals$$}]]], StandardForm]], DynamicModuleValues:>{}], "SummaryItem"], "\[SpanFromLeft]"} }, AutoDelete->False, BaseStyle->{ ShowStringCharacters -> False, NumberMarks -> False, PrintPrecision -> 3, ShowSyntaxStyles -> False}, GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{2}}, "Rows" -> {{Automatic}}}]} }, AutoDelete->False, BaselinePosition->{1, 1}, GridBoxAlignment->{"Rows" -> {{Top}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}]}, Dynamic[ Typeset`open$$], ImageSize->Automatic], BaselinePosition->Baseline], DynamicModuleValues:>{}], "]"}], DeviceObject[{"Serial", 1}], Editable->False, SelectWithContents->True, Selectable->False]], "Output", CellChangeTimes->{3.659050173712329*^9}] }, Open ]], Cell[BoxData[ RowBox[{"task", "=", RowBox[{"RunScheduledTask", "[", RowBox[{ RowBox[{"a", "=", RowBox[{"Partition", "[", RowBox[{ RowBox[{"SelectFirst", "[", RowBox[{ RowBox[{"SplitBy", "[", RowBox[{ RowBox[{"DeviceReadList", "[", RowBox[{"uno", ",", "200"}], "]"}], ",", RowBox[{ RowBox[{"Or", "[", RowBox[{ RowBox[{"#", "\[Equal]", "1"}], ",", RowBox[{"#", "\[Equal]", "0"}]}], "]"}], "&"}]}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"Length", "[", "#", "]"}], "\[Equal]", "64"}], "&"}]}], "]"}], ",", "8"}], "]"}]}], ",", ".05"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Dynamic", "[", RowBox[{"ArrayPlot", "[", RowBox[{"a", ",", RowBox[{"Mesh", "\[Rule]", "True"}]}], "]"}], "]"}]], "Input"] }, WindowSize->{942, 962}, WindowMargins->{{Automatic, 0}, {Automatic, 0}}, FrontEndVersion->"10.2 for Microsoft Windows (64-bit) (July 29, 2015)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 242, 7, 31, "Input"], Cell[825, 31, 16993, 338, 82, "Output"] }, Open ]], Cell[17833, 372, 742, 21, 92, "Input"], Cell[18578, 395, 157, 4, 31, "Input"] } ] *) (* End of internal cache information *)