Hi Lestroso,
Have you looked through this tutorial?
http://embrio.io/project...ts/color-fading-rgb-ledsIt explains how to control RBG leds by controlling each pin. Does that work with your setup or is there a special interface for your RGB leds?
For the pressure sensor you'd make something kind of like this:
<EmbrioCopy>
<Version>1.3.6.0</Version>
<Nodes>
<Node>
<UniqueID>b2302355-d79c-446d-a21b-d7177024a685</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>611</Width>
<IncludeCode>#include <SFE_BMP180.h>
#include <Wire.h></IncludeCode>
<DeclerationCode>SFE_BMP180 pressure;
#define ALTITUDE 1655.0 // Altitude of SparkFun's HQ in Boulder, CO. in meters</DeclerationCode>
<SetupCode>if (pressure.begin())
{
Output_IsConnected = 1;
}</SetupCode>
<ImageName>arduino.png</ImageName>
<InfoURL></InfoURL>
<IsOpen>True</IsOpen>
<EditWidth>360</EditWidth>
<CodeDefinitions>
<CodeDefinition>
<UpdateCondition>EveryUpdate</UpdateCondition>
<Code>char status;
double T, P, p0, a;
status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// Retrieve the completed temperature measurement:
// Note that the measurement is stored in the variable T.
status = pressure.getTemperature(T);
if (status != 0)
{
// Print out the measurement:
Output_Temperature = (9.0 / 5.0) * T + 32.0;
}
}
</Code>
<UniqueID>b8c72c75-1a30-4f83-8984-7514405adc68</UniqueID>
</CodeDefinition>
</CodeDefinitions>
<Inputs></Inputs>
<Outputs>
<Output>
<UniqueID>5de2dd07-d9ea-446b-8429-754024d2f1b2</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName>Is Connected</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>True</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>1</MaxValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Output>
<Output>
<UniqueID>09e15bf9-1256-4e6d-81d9-a407d7ffeb0e</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Integer</DefaultName>
<CustomName>Temperature</CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Integer</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.IntegerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>100</MaxValue>
</Output>
</Outputs>
</Node>
</Nodes>
</EmbrioCopy>
You want your custom nodes to do as little as possible, in this case just read the temperature. This node should be running on it's own agent with a refresh rate of 1. You'll also want to make sure to check the timing of this node in the profiler. It's bad to use "delay" in an Embrio node, but this kind of hardware needs it.
You could make another similar node and agent for pressure. Your LED agents will want to be updating faster, probably 32 times per second. If the temp and pressure readings take too long that might limit how fast your should set the LED agents. (In the near future there will be tools to help visualize this, for now you have to look at the profiler tab.)
Let me know how it goes!