Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
patwillallen  
#1 Posted : Tuesday, April 25, 2017 5:48:57 AM(UTC)
patwillallen

Rank: Newbie

Groups: BetaUser, Registered
Joined: 4/24/2017(UTC)
Posts: 5

Thanks: 5 times
Hello Forum!

As a LabVIEW developer for the last 15 years or so, I was very pleased to find Embrio. I suppose my brain has become "wired" for visual programming.

I'm currently working on an Arduino project currently based on the Mega 2650.

The project will read data from some Atlas Scientific modules (Serial and I2C), an analog sensor and some digital inputs. It will control a stepper motor and some digital outputs, based on setpoint variables that are to be adjustable through a Bluetooth interface. Some data logging is also required.

I've had success with example programs and basic use of the hardware. But I'm struggling with the framework of the larger program.

There are LOTS of supplementary tools. But some have a steep a learning curve as program itself, only to fall flat when run up against something they simply cannot do.

Embrio looks like a very interesting tool. But not having seen even the simplest example of what the generated code looks like, I'm not sure what to expect when program gets bigger.

My state machine is approaching 100 states. Is this kind of scale possible with Embrio?
EmbrioAdmin  
#2 Posted : Tuesday, April 25, 2017 6:02:01 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
Hello and welcome.

You can see the compiled program, when you upload there is a message printed in the message log on the bottom right of the screen with the location of the generated .ino file. Double click the message to get a pop-up with all recent messages if you need to. Also when you upload it prints out the resources on the arduino that were used, taken from the arduino output.

Keep in mind that the compiled code is not intended to mimic how person would write code. There is a bit of overhead. For example a "blink" program made in Embrio will have a lot more code than a regular arduino blink program. It's a bit of a trade off but usually ease of development is worth it I think.

Other than possibly running out of hardware resources the one issue you might have is with a stepper motor if it needs a very tight output signal. In Embrio code executes X times per second, from 1 up to 128. If you need something to go high for a couple ms then low you'll have to do that in an arduino node, not with the built in nodes, and it could have an effect on the smoothness of the program execution.

Anyway I think Embrio is flexible enough to do whatever you are trying to do. If you have any specific questions or need help along the way please ask.
thanks 2 users thanked EmbrioAdmin for this useful post.
patwillallen on 4/25/2017(UTC), sample@email.tst on 4/7/2024(UTC)
patwillallen  
#3 Posted : Tuesday, April 25, 2017 6:38:13 AM(UTC)
patwillallen

Rank: Newbie

Groups: BetaUser, Registered
Joined: 4/24/2017(UTC)
Posts: 5

Thanks: 5 times
Thanks for the quick reply.

I expected that both look different and have more overhead. The info about execution time relating to the stepper motor control is important though.

In this project, the stepper is a linear actuator that runs a pump. It runs intermittently, with number of steps calculated in part from sensor readings. The stepper speed isn't crucial. I will do some testing with the stepper motor today.
EmbrioAdmin  
#4 Posted : Tuesday, April 25, 2017 6:43:16 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
For the stepper motor you will probably want to make a custom arduino node. It's update code should set the pin, wait, and then set the pin. Just keep in mind this node will "lock" during that time, so you want to Keep that interval small and as consistant as you can.

To compile embrio first makes a timing program to see how long each node in the program takes to run on your hardware, so it has a "worst case" execution time for each node. Then it spreads the nodes out on a time line, reserving this worst case a mount of time for each node. When the program runs, it executes each node and waits for the unused time and any time between nodes before executing the next. So whatever you write, delay, write time is will be reserved every update.
thanks 1 user thanked EmbrioAdmin for this useful post.
patwillallen on 4/25/2017(UTC)
patwillallen  
#5 Posted : Tuesday, April 25, 2017 9:00:13 AM(UTC)
patwillallen

Rank: Newbie

Groups: BetaUser, Registered
Joined: 4/24/2017(UTC)
Posts: 5

Thanks: 5 times
Some success!

I was able to create a Custom Arduino Node based on the stepper_oneRevolution.ino example program.

This just turns the stepper one revolution in one direction, then reverses.

Initially I had a compiler error for 'stepsPerRevolution' not being declared in the scope.

There in a "const int" defined in the Declaration Code section.

const int stepsPerRevolution = 200;

But it must not be defined correctly for the code to read it. If I change the command in the code from:

myStepper.step(stepsPerRevolution);

To:

myStepper.step(200);

Then the code compiles and works.

Can I create an Input Node to work as stepsPerRevolution?
EmbrioAdmin  
#6 Posted : Tuesday, April 25, 2017 9:04:58 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
Yes you will probably want to add an activation input and convert the value to an integer in the correct range. The main currency of an embrio program is an "activation". The into tutorial videos have more about that.

You might also want to add a direction input so that the other control nodes can control the speed and direction. Remember you want as little control as you can written as code, the logic and control should be done with the other nodes usually.
thanks 1 user thanked EmbrioAdmin for this useful post.
patwillallen on 4/25/2017(UTC)
patwillallen  
#7 Posted : Tuesday, April 25, 2017 9:33:11 AM(UTC)
patwillallen

Rank: Newbie

Groups: BetaUser, Registered
Joined: 4/24/2017(UTC)
Posts: 5

Thanks: 5 times
Definitely loving all of the tutorials you've made!

I must be doing something not quite right with defining inputs.

If I change (Input_Steps) to the number I want, the code works. Otherwise, the code will upload but not start. (I'm guessing the code is getting zero values)

Is it possible to see from the XML what I'm doing wrong here?

<EmbrioCopy>
<Version>1.3.7.0</Version>
<Nodes>
<Node>
<UniqueID>0658d328-3b0a-45bb-b8d7-6327e208bebf</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.AgentControllerCustomArduinoNode</AssemblyType>
<NodeType>Custom Arduino Node</NodeType>
<UserDefinedName></UserDefinedName>
<Description>A node that lets you write any Arduino code to interact with the Arduino hardware. Can be both an input and output.</Description>
<NodeColor>144,183,227,255</NodeColor>
<X>0</X>
<Y>0</Y>
<Width>739</Width>
<IncludeCode>#include &lt;Stepper.h&gt;</IncludeCode>
<DeclerationCode>const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);</DeclerationCode>
<SetupCode> // set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);</SetupCode>
<ImageName>arduino.png</ImageName>
<InfoURL></InfoURL>
<IsOpen>True</IsOpen>
<EditWidth>360</EditWidth>
<CodeDefinitions>
<CodeDefinition>
<UpdateCondition>EveryUpdate</UpdateCondition>
<Code> // step one revolution in one direction:
Serial.println(&amp;quot;clockwise&amp;quot;);
myStepper.step(Input_Steps);
delay(500);
// step one revolution in the other direction:
Serial.println(&amp;quot;counterclockwise&amp;quot;);
myStepper.step(-Input_Steps);
delay(500);</Code>
<UniqueID>39d04f0f-cf68-4933-93ed-8cd069af9319</UniqueID>
</CodeDefinition>
</CodeDefinitions>
<Inputs>
<Input>
<UniqueID>578e1e12-1b2a-418a-a93c-3a9a2294500a</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Integer</DefaultName>
<CustomName>Steps</CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Integer</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.IntegerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<DisconnectedValue>427</DisconnectedValue>
<MinValue>200</MinValue>
<MaxValue>1000</MaxValue>
</Input>
</Inputs>
<Outputs></Outputs>
</Node>
</Nodes>
</EmbrioCopy>
EmbrioAdmin  
#8 Posted : Tuesday, April 25, 2017 9:46:19 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
I haven't compiled this but I believe it will work.

A few things to notice:

I moved the code that controls the stepper to a trigger, this way it only runs when it needs to.

I removed the "delay" calls in your code, those are very bad in Embrio. Instead I moved the logic controlling when the stepper should run to a switch and timer, which toggles turning the motor one way and the other ever second.

The reason delay calls are bad is like I said, each node reserves the amount of time it will take to run on a time line. If the code is quick, then your nodes will all execute X times per second, the refresh rate is set on the bottom right of an agent screen. If your node has 2 delays of half a second each, then every time the node executes the whole program will wait for 1 second, so instead of all of your nodes executing say 32 times per second, they will only execute once per second. Eventually I'll add a tool to visualize the compiled timeline and some warnings and errors.

In what I have below, your program will run smoothly UNTIL the trigger is fired, then the whole program will pause while the "myStepper.step(steps);" line completes. Depending on what else is happening in your program this may or may not be a problem.

<EmbrioCopy>
<Version>1.3.6.0</Version>
<Nodes>
<Node>
<UniqueID>b2374b34-dea5-41e7-b97d-3bfbd55d9c0e</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.DynamicNode</AssemblyType>
<NodeType>Startup Trigger</NodeType>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>229,229,197,255</NodeColor>
<X>0</X>
<Y>0</Y>
<Width>260</Width>
<DefinitionID>c9315389-c2e7-4f40-bcfe-8a678ef89373</DefinitionID>
<Inputs></Inputs>
<Outputs>
<Output>
<UniqueID>42c5c860-33ee-4670-a0c2-0ee1fc514dbc</UniqueID>
<DefinitionID>9533a00b-d9fd-472e-a2d9-739a7be82c2e</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>d95fa385-7010-4264-8894-6f0537b895b1</UniqueID>
<AssemblyType>Embrio.Nodes.FlowControl.TimerNode</AssemblyType>
<NodeType>Timer</NodeType>
<UserDefinedName></UserDefinedName>
<Description>An output activation changes based on a timer. The maximum number of seconds can be changed on the node, and the duration input scales the actual time used. Triggers fire when the timer is started, stopped, finished, and restarted.</Description>
<NodeColor>229,229,197,255</NodeColor>
<X>309.866666666666</X>
<Y>24.0666666666668</Y>
<Width>260</Width>
<EndBehavior>MinValue</EndBehavior>
<MaxTimeSeconds>1</MaxTimeSeconds>
<Inputs>
<Input>
<UniqueID>9bcb6d40-612d-4d3e-85ae-358df44558df</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Start</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>61556964-562b-41b9-b227-0eb4fde8956a</Output>
<Output>42c5c860-33ee-4670-a0c2-0ee1fc514dbc</Output>
</ConnectedOutputs>
</Input>
<Input>
<UniqueID>e955dfad-2275-4a82-8052-6b5065dab05f</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Stop</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
<Input>
<UniqueID>f17edae0-9065-422b-a022-7da21b19dc4b</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Restart</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
<Input>
<UniqueID>c73c2de9-a20d-4928-a8b9-2b46afec8be9</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Duration</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>1</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>d6c30743-c152-449b-ab3a-b0284f81a04f</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Started</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>61556964-562b-41b9-b227-0eb4fde8956a</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Finished</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>282c617d-1e62-4e47-aa10-38db287fcb33</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Stopped</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>b9783c6e-89dd-40d6-9b03-00b3bccc86bd</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Restarted</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>cfaedce9-7909-414e-881d-37564fa299f3</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Output</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>1</MaxValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>17c28013-ae72-445f-9757-0e0981c91b11</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.DynamicNode</AssemblyType>
<NodeType>Switch</NodeType>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>229,229,197,255</NodeColor>
<X>613.2</X>
<Y>14.0666666666668</Y>
<Width>260</Width>
<DefinitionID>13030c99-98ce-4f5b-bdc5-5ee155eac37c</DefinitionID>
<Inputs>
<Input>
<UniqueID>8fabaa97-8de5-45da-b904-428c1f5c6bf8</UniqueID>
<DefinitionID>a8114d67-28ba-43a7-b292-5065f966dde3</DefinitionID>
<DefaultName>On Value</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>1</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>85ccc143-5c28-48d8-aecd-f2d49a08bffd</UniqueID>
<DefinitionID>88d36748-1367-442a-997a-1055f1fe32f4</DefinitionID>
<DefaultName>Off Value</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>-1</DisconnectedValue>
<UseNegativeRange>True</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>04e6abb2-9aab-483b-997b-a7adeeeb3f99</UniqueID>
<DefinitionID>b53a92f7-c2ee-4c85-a58b-3bbc75dafae0</DefinitionID>
<DefaultName>Turn On</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
<Input>
<UniqueID>786ca777-5378-408d-8ea5-efe0cf528329</UniqueID>
<DefinitionID>f892a324-2a05-4132-bbe1-e4038aad4f0f</DefinitionID>
<DefaultName>Turn Off</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
<Input>
<UniqueID>ddf1c563-8508-49b8-8906-c0e20e620893</UniqueID>
<DefinitionID>e6265564-36b2-4ca6-8da9-4516345f3a7e</DefinitionID>
<DefaultName>Toggle</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>61556964-562b-41b9-b227-0eb4fde8956a</Output>
</ConnectedOutputs>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>7d1f07bb-b94f-4149-9fcc-40f95bed6c9d</UniqueID>
<DefinitionID>5298cec5-3257-4ea1-9ed0-0f06b7be1293</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<MinValue>-1</MinValue>
<MaxValue>1</MaxValue>
<UseNegativeRange>True</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Output>
<Output>
<UniqueID>601a1d68-6a9d-4f73-9b43-51500c3253bc</UniqueID>
<DefinitionID>a20f60f2-2608-48db-92cf-90be81dcb5b6</DefinitionID>
<DefaultName>Turned On</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>23523732-d5dd-4715-ab8e-e9a9e17f7073</UniqueID>
<DefinitionID>c67e21ce-6ec8-4048-9973-3cedb4ee8927</DefinitionID>
<DefaultName>Turned Off</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>461df032-0905-406e-98dd-1cf46b29bbcb</UniqueID>
<DefinitionID>52f1e9c7-efa8-48db-8a10-7dd671aa74ae</DefinitionID>
<DefaultName>Toggled</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>d6e9c885-f33a-455c-9c13-d15491df3005</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.AgentControllerCustomArduinoNode</AssemblyType>
<NodeType>Custom Arduino Node</NodeType>
<UserDefinedName></UserDefinedName>
<Description>A node that lets you write any Arduino code to interact with the Arduino hardware. Can be both an input and output.</Description>
<NodeColor>144,183,227,255</NodeColor>
<X>923.2</X>
<Y>67.4000000000001</Y>
<Width>749</Width>
<IncludeCode>#include &lt;Stepper.h&gt;</IncludeCode>
<DeclerationCode>int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);</DeclerationCode>
<SetupCode> // set the speed at 60 rpm:
myStepper.setSpeed(60);
</SetupCode>
<ImageName>arduino.png</ImageName>
<InfoURL></InfoURL>
<IsOpen>True</IsOpen>
<EditWidth>360</EditWidth>
<CodeDefinitions>
<CodeDefinition>
<TriggerInputID>e214aee2-d6ee-4b63-9b26-c78a2019580e</TriggerInputID>
<UpdateCondition>Trigger</UpdateCondition>
<Code>int steps = transform(Input_Steps, 0.0, 1.0, 200, 1000);
if (Input_Direction &amp;lt; 0)
{
steps = steps * -1;
}
myStepper.step(steps);</Code>
<UniqueID>2750eadb-0192-4fab-b757-22d43ef0437f</UniqueID>
</CodeDefinition>
</CodeDefinitions>
<Inputs>
<Input>
<UniqueID>db946d50-b9dd-4e4d-bb43-c2ff4ed1dd56</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Activation 1</DefaultName>
<CustomName>Steps</CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>0.27</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>9ed30dcc-3cfe-472e-833f-63899ad0b426</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName>Direction</CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<ConnectedOutputs>
<Output>7d1f07bb-b94f-4149-9fcc-40f95bed6c9d</Output>
</ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>0</DisconnectedValue>
<UseNegativeRange>True</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>e214aee2-d6ee-4b63-9b26-c78a2019580e</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<ConnectedOutputs>
<Output>461df032-0905-406e-98dd-1cf46b29bbcb</Output>
</ConnectedOutputs>
</Input>
</Inputs>
<Outputs></Outputs>
</Node>
</Nodes>
</EmbrioCopy>
thanks 1 user thanked EmbrioAdmin for this useful post.
patwillallen on 4/25/2017(UTC)
EmbrioAdmin  
#9 Posted : Tuesday, April 25, 2017 9:49:53 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
To further explain the time line thing, in the left toolbar click on the Profiler tab. This shows how long your nodes take to run on your hardware. To get values, you press the clock icon in the footer, this compiles and uploads a timing program which runs your nodes on your hardware and sends back the measurements.

In the summary on top of the profiler you have "max milliseconds per second". This should stay well below 1000, otherwise your program won't run in real time.

In the grids, MSPU and MSPS are "Microseconds per update" and "Microseconds per second". This shows you in MICRO seconds (not milliseconds) how long each node takes to update once, and multiplies that by how many times it updates per second, so you can see how much of your program time each node uses.
thanks 1 user thanked EmbrioAdmin for this useful post.
patwillallen on 4/25/2017(UTC)
patwillallen  
#10 Posted : Tuesday, April 25, 2017 10:56:38 AM(UTC)
patwillallen

Rank: Newbie

Groups: BetaUser, Registered
Joined: 4/24/2017(UTC)
Posts: 5

Thanks: 5 times
Thanks for the example!
It's very slick how the XML pastes into the editor.

The code does upload and run the stepper. At first the stepper only ran in one direction. But after re-pasting to a new project, it ran in both. I'm still testing...and learning. :)

The profiler reported a MMPS of 0.576 for the Agent.

Although when I clicked on the clock icon at the bottom left, the program starting running in only one direction. I had to quickly upload a blank program when the actuator hit its limit.

Not sure why, but after that I had trouble getting the Embrio code to run again until I restarted Embrio and reconnected. It would upload OK. But then nothing would happen. It seems fine after restarting. Probably just something I'm doing when I check the timing.

I'm going to go through a bunch more of your tutorials and see if I can build up a very scaled down version of my project first.

So far things look promising!
tomrichard618  
#11 Posted : Monday, July 31, 2017 5:12:59 PM(UTC)
tomrichard618

Rank: Newbie

Groups: Registered
Joined: 7/25/2017(UTC)
Posts: 3

I think Embrio is flexible enough to do whatever you are trying to do
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error