Page 16 of 33 FirstFirst ... 67891011121314151617181920212223242526 ... LastLast
Results 151 to 160 of 328

Thread: Fusion Brain Version 6 -- Beta Testing

  1. #151
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Quote Originally Posted by rEegLer View Post
    I posted the c# code I used in post #127. Does that look right? I tried just having it display a message box based on the analog value and that didn't work. So it's not receiving any value from the FB, not even 0 as that would have returned a message so I'm thinking it is just something with the code.
    Did you include the windows form reference if you are trying to use a messagebox?

    -- Nick
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  2. #152
    Variable Bitrate rEegLer's Avatar
    Join Date
    Jul 2008
    Location
    Mechanicsburg, PA
    Posts
    266
    Quote Originally Posted by 2k1Toaster View Post
    Did you include the windows form reference if you are trying to use a messagebox?
    That I did not do. Is that just:

    Code:
    Using System.Windows.Forms;
    ?
    Love

  3. #153
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    using with a lower case "u" but otherwise yes. Right at the top by the rest of the usings

    using System.Windows.Forms;

    Then to call a messagebox, do "MessageBox.Show("test");"

    Put this in the function you call from the startup event in FuseGL's config. As soon as the program loads, it should compile your code and display a message box. If a box displays, then all messageboxes in that part of the code will work, so you can move on to seeing if it is that or something else. That and messageboxes are useful tools for debug.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  4. #154
    Variable Bitrate rEegLer's Avatar
    Join Date
    Jul 2008
    Location
    Mechanicsburg, PA
    Posts
    266
    Quote Originally Posted by 2k1Toaster View Post
    If a box displays, then all messageboxes in that part of the code will work, so you can move on to seeing if it is that or something else. That and messageboxes are useful tools for debug.
    I put it right before the first If statement and it didn't do anything. Does it matter that I don't have my FB connected? I would think it would compile it regardless of a connection.
    Love

  5. #155
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    In the trace file it should print out the compile error. Do you see anything like that in there?
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  6. #156
    Variable Bitrate rEegLer's Avatar
    Join Date
    Jul 2008
    Location
    Mechanicsburg, PA
    Posts
    266
    Doing a quick search of the trace file brings up this:

    [1189] 20.09.11|13:46:22:938 >> Adding [events] to iSetting Master Hash : {<events><startup action="FuseGL.ExecuteCode" inputArgs="Logic.cs;FuseGL_Logic.CarPC;doSomething Event;{FB.AnalogueInput(0.4)};" /><onMouseDown action="FB.TurnOnDigitalOutput" inputArgs="Port:0.01" /></events>}

    That's all I get with reference to the Logic.cs file.
    Love

  7. #157
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    You are indeed correct. If the code throws an exception (something went wrong) then it is swallowed by FuseGL so that you don't notice it and no trace is left. I have modified it so that it does produce a trace file log item for that.

    I am thinking it may be missing references. Meaning when you say "using System.Windows.Forms", it needs to have the System.Windows.Forms reference to be able to use it. I use no such reference, so it likely bails.

    I working on a solution now.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  8. #158
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Ok Fixed. I have a test file that just pops up the voltage of the analogue input in a messagebox and it all works
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  9. #159
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    Code:
    using System;
    using System.Collections.Generic;
    using FB_USB_2011;
    using FuseGL.GUI.Text;
    using FuseGL.Logic;
    using System.Windows.Forms;
    
    namespace FuseGL_doOnAnalogue
    {
        class ShowMessageBoxWithValue
        {
            Dictionary<FB_Monitor.AnalogueInputPort, System.Timers.Timer> allAnaloguePortsToDisplay = new Dictionary<FB_Monitor.AnalogueInputPort, System.Timers.Timer>();
    
            public ShowMessageBoxWithValue()
            {
                Console.WriteLine("This gets called the first time only...");
            }
    
            public object RegisterAnalogueInput(FB_Monitor.AnalogueInputPort _port, int how_often_in_milliseconds, object[] extraInputParams)
            {
                if (allAnaloguePortsToDisplay.ContainsKey(_port)) { return true; }
    
                System.Timers.Timer _timer = new System.Timers.Timer();
                _timer.AutoReset = true;
                _timer.Interval = how_often_in_milliseconds;
                _timer.Elapsed += delegate(object sender, System.Timers.ElapsedEventArgs e)
                {
                    string s = "here for port " + _port.Port.ToString() + ": " + _port.Value.ToString("0.000") + "v";
                    Console.WriteLine(s);
                    FuseGL.FuseGL_Debugger.Trace.Add(s);
                    System.Windows.Forms.MessageBox.Show(s);
                };
                _timer.Start();
                return true;
            }
        }
    }
    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <FuseGL_User_Settings>
      <FuseGL_GUI_Settings>
        <setting type="size" name="gui_size" width="90%" height="600" />
        <setting type="int" gui_border_thickness="1" />
        <setting type="colour" gui_border_colour="85,85,85" />
      </FuseGL_GUI_Settings>
      <Startup_Events>
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="Logic/doOnAnalogue.cs;FuseGL_doOnAnalogue.ShowMessageBoxWithValue;RegisterAnalogueInput;{FB.AnalogueInput(0.1)};{(int)10000};" />
          <startup action="FB.TurnOnDigitalOutput" inputArgs="Port:0.10" />
        </events>
      </Startup_Events>
      <Persistant_Variables>
        <variable type="bool" first_value="true" name="persistant_boolean" />
        <variable type="int" first_value="0" name="persistant_incrementer" />
      </Persistant_Variables>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="Digital Output Test Button ON" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButton" />
        <image_hover location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButtonHover" />
        <image_click location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButtonHover" />
        <text text="Turn On 0.10" />
        <!-- Make all the customizations like font size, and the actual font optional -->
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <size width="200" height="33" />
        <location x="100" y="100" z="0" alignment="center" />
        <events>
          <onMouseDown action="FB.TurnOnDigitalOutput" inputArgs="Port:0.10" />
          <onMouseDown action="FuseGL.ExecuteCode" inputArgs="ChangeTextOnDigitalOutputChange.cs;FuseGL_TextManipulation.InternalFlyCompile_ChangeTextOnDigitalOutputChange;ChangeButtonTextOnDigitalOutputPersistant;{FB.DigitalOutput(0.10)};{this.text};" outputTo="this.text.text" />
        </events>
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="Digital Output Test Button OFF" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButton" />
        <image_hover location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButtonHover" />
        <image_click location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButtonHover" />
        <text text="Turn On 0.10" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <size width="200" height="33" />
        <location x="100" y="150" z="0" alignment="center" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="ChangeTextOnDigitalOutputChange.cs;FuseGL_TextManipulation.InternalFlyCompile_ChangeTextOnDigitalOutputChange;ChangeButtonTextOnDigitalOutputPersistant;{FB.DigitalOutput(0.10)};{this.text};" outputTo="this.text.text" />
          <onMouseDown action="FB.TurnOffDigitalOutput" inputArgs="Port:0.10" />
        </events>
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="Digital Output Test Button Toggle" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButton" />
        <image_hover location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButtonHover" />
        <image_click location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButtonHover" />
        <text text="Unknown State" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <size width="200" height="33" />
        <location x="100" y="200" z="0" alignment="center" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="ChangeTextOnDigitalOutputChange.cs;FuseGL_TextManipulation.InternalFlyCompile_ChangeTextOnDigitalOutputChange;ChangeButtonTextOnDigitalOutputPersistant;{FB.DigitalOutput(0.10)};{this.text};FLY Digital Output ON; FLY Digital Output OFF;" outputTo="this.text.text" />
          <onMouseDown action="FB.ToggleDigitalOutput" inputArgs="Port:0.10" />
        </events>
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="Analogue Input 0.0 Display Label" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.BaseButton" />
        <text text="Unknown State" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="true" />
        <size width="200" height="33" />
        <location x="500" y="500" z="0" alignment="center" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="UpdateLabelText.cs;FuseGL_TextManipulation.InternalFlyCompile_UpdateLabelText;ChangeButtonTextOnAnalogueInputPersistant;{FB.AnalogueInput(0.1)};{this.text};0.000;" outputTo="this.text.text" />
        </events>
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - LBL - Show Thing:Variable[persistant_incrementer]" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.UserButtonBackground" />
        <text text="{$[*].persistant_incrementer}" />
        <size width="180" height="30" />
        <location x="105" y="300" alignment="left" z="0.0" />
        <setting type="int" border_size="1" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="false" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="UpdateLabelText.cs;FuseGL_TextManipulation.InternalFlyCompile_UpdateLabelText;ChangeButtonTextOnVariablePersistant;{$[*].persistant_incrementer};{this.text};" outputTo="this.text.text" />
        </events>
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - LBL - Show Thing:Variable[persistant_incrementer]" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.UserButtonBackground" />
        <text text="{$[*].persistant_incrementer.Value}" />
        <size width="180" height="30" />
        <location x="90" y="345" alignment="left" z="0.0" />
        <setting type="int" border_size="1" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="false" />
        <events>
          <startup action="FuseGL.ExecuteCode" inputArgs="UpdateLabelText.cs;FuseGL_TextManipulation.InternalFlyCompile_UpdateLabelText;ChangeButtonTextOnVariablePersistant;{$[*].persistant_incrementer};{this.text};" outputTo="this.text.text" />
        </events>
      </User_Object>
      <User_Object type="FuseGL_Object">
        <setting type="string" name="GL - LBL - Show Thing:Variable[persistant_incrementer]" />
        <image location="internal" path="FuseGL.Configurator.Configurator_IMG_Resources.UserButtonBackground" />
        <text text="{$[*].persistant_incrementer.Value}" />
        <size width="180" height="30" />
        <location x="90" y="390" alignment="left" z="0.0" />
        <setting type="int" border_size="1" />
        <setting type="bool" mouse_cursor_to_hand_on_hover="false" />
        <events>
          <onMouseDown action="FuseGL.ExecuteCode" inputArgs="CustomGooCode.cs;CustomGoo_Namespace.YourCustomGooParentClassName;DigitalOutputPort___IncreaseValue;{FB.DigitalOutput(0.10)};"/>
        </events>
      </User_Object>
    </FuseGL_User_Settings>
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  10. #160
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,049
    If you download the *.zip file in the first post for the 29/09/2011 it has everything you need in there.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

Similar Threads

  1. ** NEW Fusion Brain Version 6, Pre-Order NOW **
    By 2k1Toaster in forum Fusion Brain
    Replies: 259
    Last Post: 04-07-2013, 03:48 PM
  2. Fusion Brain version 4
    By MattFreitag in forum Fusion Brain
    Replies: 7
    Last Post: 08-01-2010, 05:32 PM
  3. Fusion Brain -- Digital Encoder Beta Test
    By 2k1Toaster in forum Fusion Brain
    Replies: 52
    Last Post: 09-18-2009, 03:11 PM
  4. Fusion Brain Version 4 Manual
    By greenman100 in forum FB Documentation and Tutorials
    Replies: 0
    Last Post: 12-19-2008, 03:11 PM
  5. Fusion Brain Version 4 ready for Beta Testers!
    By greenman100 in forum Fusion Brain
    Replies: 15
    Last Post: 11-13-2008, 11:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •