Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
ChrisXP  
#1 Posted : Monday, February 19, 2018 12:46:31 PM(UTC)
ChrisXP

Rank: Newbie

Groups: Registered
Joined: 2/19/2018(UTC)
Posts: 3

Hello Everybody,

I trying Embrio for the first time, it seem's to be incredible software !

But i don't understand how can i use custom node for TM1637 4 digits display.

When i upload this sketch directly with Arduino's software, that's work :

Code:

#include <Arduino.h>
#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 2
#define DIO 3

TM1637Display display(CLK, DIO);
void setup()
{
}

void loop()
{

  display.setBrightness(0x0f);
  display.showNumberDec(1234,false);
 
}



But when i try to use custom node, that's don't work...

Node Definition 1
Input 1 : name CLK set to 2
Input 2 : name DIO set to 3

---Declarations---
#include <Arduino.h>
#include <TM1637Display.h>

TM1637Display display(Input_CLK, Input_DIO);

---Startup---
display.setBrightness(0x0f);
display.showNumberDec(1234,false);


Someone could help me ?
Thanks in advance for your help :)










EmbrioAdmin  
#2 Posted : Tuesday, February 20, 2018 5:56:59 PM(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)
Hi Chris,

This looks like a pretty easy one. For future reference, you can copy and paste nodes as plain text XML, just copy them from Embrio and paste them into any text area.

Because the node I created had an icon and referenced files it's too big to paste into a forum response, so I skipped this step and added it to the library, you can see it here or in the library toolbar in Embrio under Outputs -> LCD and Display.

Based on your description I'm not really sure how you implemented your node, but below are notes on my implementation.

The first step is to include any files you need into your Embrio project (I assume this is where you had trouble, also setting the values from node inputs instead of hardcoded values). To do this, I downloaded TM1637Display.h and .cpp, I assume those are the correct files. Then in my Embrio project, I right click on the controller node in the tree view (with the Arduino logo) and click on Controller Settings, then I click on Load File(s) and select both of these files. Now when Embrio compiles its generated program, it will copy both of these files into the compile directory. Note that when you paste the below node it will add those files to your project so you can skip this step, it's just for future reference.

I'm not sure exactly how you are going to use your display, meaning where the number you are going to show comes from. For this example I'm assuming it's just an integer value you have somewhere. If you wanted to combine several single integers into one display value we would do this differently.

The node has 4 integer inputs, one for the value, one for the brightness, and 2 for configuration. Notice that the configuration inputs are grayed out and you can't attach outputs to, these are for configuration only, so just set the click and data pins to match your hardware.

You should be able to upload this node (add it to an agent then open a connection to your Arduino), then drag the brightness and value inputs to update your hardware.

Open the node to see its code by clicking the open arrow icon on the top right of the node. Here are some notes about it's implementation:

In the declaration section we create an instance of TM1637Display using the setup inputs. This is possible in this section because the little gear icon next to those inputs is hilighted, you can't use regular inputs or outputs in the declaration section of a node.

Then there are two simple "on change" events. These are created by pressing the + icon next to the drop down list, then clicking the check box next to the input that should fire the code. There is one for brightness and value, which simply use the code you pasted below, but uses the node inputs as values.

Note that I haven't tested this as I don't have the hardware. Could you please let me know if it works for you? Also like I said I'm not sure how you're using the node, but we might want to change it to have 2 integer inputs, one for the first 2 digits and one for the second 2 digits.

Edit: I found and fixed a small bug in the node, if by chance you tried to use this before this edit, delete the node from your project (the tool tab with the Embrio icon), restart Embrio, and readd it.

Edited by user Tuesday, February 20, 2018 6:28:58 PM(UTC)  | Reason: Not specified

ChrisXP  
#3 Posted : Wednesday, February 21, 2018 11:22:37 AM(UTC)
ChrisXP

Rank: Newbie

Groups: Registered
Joined: 2/19/2018(UTC)
Posts: 3

Hello Admin,

Thanks for your reply,

I pasted your node from your library, it's work perfectly :) :) :)

But, when i try to create the same node, with the same input (with little gear for pin), code, event, and "touch physical pin" checked, but that's don't work..

I have the both library in the controller settings.

This is my node, just a copy of your code, what is the difference ?

<EmbrioCopy>
<Version>2.2.0.7</Version>
<Name></Name>
<UniqueID>00000000-0000-0000-0000-000000000000</UniqueID>
<Description></Description>
<NodeColor>128,128,128,255</NodeColor>
<IsBuiltIn>False</IsBuiltIn>
<ImageByteArray></ImageByteArray>
<Nodes>
<Node>
<UniqueID>cb1c7657-2106-4561-b6f0-6f33acaadb60</UniqueID>
<NodeType>Dynamic</NodeType>
<NodeName>Node Definition</NodeName>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>201,227,222,255</NodeColor>
<X>0</X>
<Y>0</Y>
<Width>600</Width>
<DefinitionID>de3120a5-dd21-4512-97da-fcccc2467fee</DefinitionID>
<EditingProperties>
<IsInEditMode>True</IsInEditMode>
<CodeHeight>300</CodeHeight>
<EditedLanguage>Arduino</EditedLanguage>
<IsEditingIODefinitions>False</IsEditingIODefinitions>
<UpdateCodeDefinitionID>bbcaf991-e544-494c-ad00-7610fec1f823</UpdateCodeDefinitionID>
</EditingProperties>
<SetLength>0</SetLength>
<SetInputs></SetInputs>
<SetOutputs></SetOutputs>
<Inputs>
<Input>
<UniqueID>687e0c0e-373f-4ddd-bae9-1c495e6d10b2</UniqueID>
<DefinitionID>17a2b58d-9297-4332-b6b3-468b380a6048</DefinitionID>
<DefaultName>Value</DefaultName>
<CustomName></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>
<ConnectedOutputs></ConnectedOutputs>
<DisconnectedValue>2133</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>9999</MaxValue>
</Input>
<Input>
<UniqueID>c769a54b-4257-4fe1-83d9-307e85d08250</UniqueID>
<DefinitionID>47df267f-774f-4807-a865-606f7fb2e47a</DefinitionID>
<DefaultName>Brightness</DefaultName>
<CustomName></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>
<ConnectedOutputs></ConnectedOutputs>
<DisconnectedValue>147</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>255</MaxValue>
</Input>
<Input>
<UniqueID>cbbaaeda-895d-473c-bbf3-7a5458e50986</UniqueID>
<DefinitionID>e9dae5a1-be10-4fa8-9cda-a00a9bb75a69</DefinitionID>
<DefaultName>Click Pin</DefaultName>
<CustomName></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>
<ConnectedOutputs></ConnectedOutputs>
<DisconnectedValue>2</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>5</MaxValue>
</Input>
<Input>
<UniqueID>3f5c9512-9e7f-4c7c-8e38-202b8cd2fae7</UniqueID>
<DefinitionID>c5c13272-09e4-40ff-8cf5-12ccbe571e39</DefinitionID>
<DefaultName>Data Pin</DefaultName>
<CustomName></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>
<ConnectedOutputs></ConnectedOutputs>
<DisconnectedValue>3</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>5</MaxValue>
</Input>
</Inputs>
<Outputs></Outputs>
</Node>
</Nodes>
<NodeDefinitions>
<Definition>
<Name>Node Definition</Name>
<SoftwareVersion>2.2.0.7</SoftwareVersion>
<UniqueID>de3120a5-dd21-4512-97da-fcccc2467fee</UniqueID>
<Description></Description>
<UseIOSet>False</UseIOSet>
<InputDefinitions>
<InputDefinition>
<Type>Embrio.NodeEngine.Definitions.IntegerNodeInputDefinition</Type>
<Name>Value</Name>
<UniqueID>17a2b58d-9297-4332-b6b3-468b380a6048</UniqueID>
<IsOutsideConnection>False</IsOutsideConnection>
<IsInIOSet>False</IsInIOSet>
<IsUserAdded>True</IsUserAdded>
<ConfigurationOnly>False</ConfigurationOnly>
<DisconnectedValue>0</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>100</MaxValue>
</InputDefinition>
<InputDefinition>
<Type>Embrio.NodeEngine.Definitions.IntegerNodeInputDefinition</Type>
<Name>Brightness</Name>
<UniqueID>47df267f-774f-4807-a865-606f7fb2e47a</UniqueID>
<IsOutsideConnection>False</IsOutsideConnection>
<IsInIOSet>False</IsInIOSet>
<IsUserAdded>True</IsUserAdded>
<ConfigurationOnly>False</ConfigurationOnly>
<DisconnectedValue>0</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>100</MaxValue>
</InputDefinition>
<InputDefinition>
<Type>Embrio.NodeEngine.Definitions.IntegerNodeInputDefinition</Type>
<Name>Click Pin</Name>
<UniqueID>e9dae5a1-be10-4fa8-9cda-a00a9bb75a69</UniqueID>
<IsOutsideConnection>False</IsOutsideConnection>
<IsInIOSet>False</IsInIOSet>
<IsUserAdded>True</IsUserAdded>
<ConfigurationOnly>True</ConfigurationOnly>
<DisconnectedValue>0</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>100</MaxValue>
</InputDefinition>
<InputDefinition>
<Type>Embrio.NodeEngine.Definitions.IntegerNodeInputDefinition</Type>
<Name>Data Pin</Name>
<UniqueID>c5c13272-09e4-40ff-8cf5-12ccbe571e39</UniqueID>
<IsOutsideConnection>False</IsOutsideConnection>
<IsInIOSet>False</IsInIOSet>
<IsUserAdded>True</IsUserAdded>
<ConfigurationOnly>True</ConfigurationOnly>
<DisconnectedValue>0</DisconnectedValue>
<MinValue>0</MinValue>
<MaxValue>100</MaxValue>
</InputDefinition>
</InputDefinitions>
<OutputDefinitions></OutputDefinitions>
<UpdateCodes>
<UpdateCode>
<UpdateCondition>Declaration</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code></Code>
<Language>CSharp</Language>
</Implementation>
<Implementation>
<Code>#include &amp;quot;TM1637Display.h&amp;quot;

TM1637Display display(Input_ClickPin, Input_DataPin);</Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>bbcaf991-e544-494c-ad00-7610fec1f823</UniqueID>
</UpdateCode>
<UpdateCode>
<UpdateCondition>Startup</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code></Code>
<Language>CSharp</Language>
</Implementation>
<Implementation>
<Code></Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>6af6b443-68dc-487f-9172-8aa57244b050</UniqueID>
</UpdateCode>
<UpdateCode>
<UpdateCondition>EveryUpdate</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code></Code>
<Language>CSharp</Language>
</Implementation>
<Implementation>
<Code></Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>3d5d6c38-f6af-4aa4-85ec-06cb9b391011</UniqueID>
</UpdateCode>
<UpdateCode>
<UpdateCondition>Shutdown</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code></Code>
<Language>CSharp</Language>
</Implementation>
<Implementation>
<Code></Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>43587ec5-8821-45c2-91fb-f562d7d5612f</UniqueID>
</UpdateCode>
<UpdateCode>
<UpdateCondition>None</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code></Code>
<Language>CSharp</Language>
</Implementation>
<Implementation>
<Code></Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>2bbee6e6-ee6d-4f87-b2f6-a7453eb65897</UniqueID>
</UpdateCode>
<UpdateCode>
<UpdateCondition>InputChange</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code>display.setBrightness(Input_Brightness);</Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>b6938867-d35c-4dac-9953-1a516ec3a696</UniqueID>
<Inputs>
<Input>47df267f-774f-4807-a865-606f7fb2e47a</Input>
</Inputs>
</UpdateCode>
<UpdateCode>
<UpdateCondition>InputChange</UpdateCondition>
<CodeImplementations>
<Implementation>
<Code>display.showNumberDec(Input_Value, false);</Code>
<Language>Arduino</Language>
</Implementation>
</CodeImplementations>
<UniqueID>3d93b150-a61b-487a-b32c-c4562f655752</UniqueID>
<Inputs>
<Input>17a2b58d-9297-4332-b6b3-468b380a6048</Input>
</Inputs>
</UpdateCode>
</UpdateCodes>
<NodeColor>201,227,222,255</NodeColor>
<IsBuiltIn>False</IsBuiltIn>
<TouchesPin>True</TouchesPin>
<IsLanguageLocked>False</IsLanguageLocked>
<UseCanvas>False</UseCanvas>
<CanvasHeight>150</CanvasHeight>
<CategoryName>Project</CategoryName>
</Definition>
</NodeDefinitions>
</EmbrioCopy>


EmbrioAdmin  
#4 Posted : Wednesday, February 21, 2018 12:07:24 PM(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)
That's a good question... I can't see anything that doesn't look right.

What do you mean by it doesn't work? Do you get an error when compiling? Or the display just doesn't update?
ChrisXP  
#5 Posted : Thursday, February 22, 2018 7:31:55 AM(UTC)
ChrisXP

Rank: Newbie

Groups: Registered
Joined: 2/19/2018(UTC)
Posts: 3

The display don't work,
But no error during compiling and update :/


EmbrioAdmin  
#6 Posted : Thursday, February 22, 2018 8:39:50 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'd like to investigate, could you zip up your project folder and send it to me at ezra@embrio.io?

You can right click on the root node of the project and click "view folder location" to get to the folder on disk easily.

Thanks.
EmbrioAdmin  
#7 Posted : Thursday, February 22, 2018 4:05:04 PM(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)
Thank you for sending me the project. There was a bug, the new "configuration only" inputs were using the node definition inputs default value instead of the node instance input value. It's fixed, you can upgrade by opening Embrio and selecting "new version available" from the menu.

I got my TM1637 display in the mail today, it's super easy to set up and weirdly fun to watch the numbers change! I have mine hooked up to a potentiometer.

Also by the way, I noticed the agent in your project was set to update 512 times per second. That's probably way overkill, unless you're doing something crazy you can probably get away with the default 32 updates per second, or 64 if you need it really fast.
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