Rank: Newbie
Groups: BetaUser, Registered Joined: 4/2/2015(UTC) Posts: 8  Location: Montreal
|
I try to display the string text from the Output_Text and it does not appear on the Add Output_Text variable. Any hints?
This is the code:
<Nodes> <Node> <UniqueID>2e6f59a5-23cf-4f48-bb06-edec1b1426ce</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>201,204,227,255</NodeColor> <X>0</X> <Y>0</Y> <Width>380</Width> <IncludeCode>#include <dht11.h></IncludeCode> <DeclerationCode>#define dht_dpin 2 dht DHT;</DeclerationCode> <SetupCode></SetupCode> <ImageName>arduino.png</ImageName> <InfoURL></InfoURL> <CodeDefinitions> <CodeDefinition> <UpdateCondition>EveryUpdate</UpdateCondition> <Code>DHT.read11(dht_dpin); String Output_Text = ToString(DHT.temperature); </Code> <UniqueID>1798ed00-a17c-4b67-ae60-f0cce0966249</UniqueID> </CodeDefinition> </CodeDefinitions> <Inputs></Inputs> <Outputs> <Output> <UniqueID>f2e3b8b8-ed29-43ca-9fee-5820d4924aaa</UniqueID> <DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID> <DefaultName>Text</DefaultName> <CustomName>Output_Text</CustomName> <IsDisplayed>True</IsDisplayed> <IsNative>False</IsNative> <TypeName>String</TypeName> <IsOutsideConnection>True</IsOutsideConnection> <IOType>Embrio.NodeEngine.NodeIO.StringNodeOutput</IOType> <ShowGraph>False</ShowGraph> <LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID> <IsUserAdded>True</IsUserAdded> <MaxLength>10</MaxLength> </Output> </Outputs> </Node> </Nodes>
Thanks.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/11/2014(UTC) Posts: 661
Thanks: 1 times Was thanked: 36 time(s) in 33 post(s)
|
I see two things. Rename the output to just "Text", and remove the "String " from your code. Using Output_Name in code is so that Embrio knows that you're trying to access an input or an output, you could have both an input and output with the same name. Try pasting this node:
<Nodes> <Node> <UniqueID>14946377-7c6c-4d71-9bbe-1ca44600913c</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>201,204,227,255</NodeColor> <X>0</X> <Y>0</Y> <Width>407</Width> <IncludeCode>#include <dht11.h></IncludeCode> <DeclerationCode>#define dht_dpin 2 dht DHT;</DeclerationCode> <SetupCode></SetupCode> <ImageName>arduino.png</ImageName> <InfoURL></InfoURL> <CodeDefinitions> <CodeDefinition> <UpdateCondition>EveryUpdate</UpdateCondition> <Code>DHT.read11(dht_dpin); Output_Text = ToString(DHT.temperature); </Code> <UniqueID>1798ed00-a17c-4b67-ae60-f0cce0966249</UniqueID> </CodeDefinition> </CodeDefinitions> <Inputs></Inputs> <Outputs> <Output> <UniqueID>2e95d78e-ef67-4ea6-ace2-4a01dd740006</UniqueID> <DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID> <DefaultName>Text</DefaultName> <CustomName>Text</CustomName> <IsDisplayed>True</IsDisplayed> <IsNative>False</IsNative> <TypeName>String</TypeName> <IsOutsideConnection>True</IsOutsideConnection> <IOType>Embrio.NodeEngine.NodeIO.StringNodeOutput</IOType> <ShowGraph>False</ShowGraph> <LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID> <IsUserAdded>True</IsUserAdded> <MaxLength>10</MaxLength> </Output> </Outputs> </Node> </Nodes>
|
|
|
|
Rank: Newbie
Groups: BetaUser, Registered Joined: 4/2/2015(UTC) Posts: 8  Location: Montreal
|
If a remove the String from my code and only use Text, I got the following error from the compiler: 'Text' was not declared in the scope
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/11/2014(UTC) Posts: 661
Thanks: 1 times Was thanked: 36 time(s) in 33 post(s)
|
The full line should be:
Output_Text = ToString(DHT.temperature);
The "Output_" part tells Embrio you're trying to access a node output, the rest is the name of the output you're trying to target.
Click on the "spoiler" tag in the last post, I hid the xml in there to keep things tidy.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/11/2014(UTC) Posts: 661
Thanks: 1 times Was thanked: 36 time(s) in 33 post(s)
|
Also, you should probably change the refresh rate (in the bottom right of the node screen) to something lower, sending text over the serial port is a little bit slow. Your node is set to update 32 times per second, which might be too much.
|
|
|
|
Rank: Newbie
Groups: BetaUser, Registered Joined: 4/2/2015(UTC) Posts: 8  Location: Montreal
|
Ok it works now, thanks for the advice.
|
|
|
|
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.