[Gambas-user] Get the object of a component by name.

Matias De lellis mati86_dl at ...1877...
Tue Feb 23 23:47:21 CET 2016


Hi Jussi 



> You don't have class named Firmata1?

No.. The class is "Firmata", and the instance name in "Fimata1"

> I think there is error in the documentation. I don't see Class having instance method.


Maybe. I did not find example of this .. :S

> Try:
> hFirmata = Object.New("Firmata")
>
> Name of the object can be passed as argument.

No.. If I do this I make a new Firmata instance for each component exucute that line .. I need to use the component that put as a control and configure only once..


Consider than a new instance of firmata involves opening a new serial port.. and this is not possible ..

Regards


El Martes, 23 de febrero, 2016 19:19:40, Jussi Lahtinen <jussi.lahtinen at ...1107...626...> escribió:



I think there is error in the documentation. I don't see Class having instance method.

Try:
hFirmata = Object.New("Firmata")


Name of the object can be passed as argument.


Jussi



On Tue, Feb 23, 2016 at 10:54 PM, Matias De lellis <mati86_dl at ...1877...> wrote:

Dear All,
>
>
>I'm starting a new project. In a few words is a set of controls to interact with Arduino using the Firmata protocol[1].
>To understand better, in general the idea is inspired by Ctrlr[2] that allows
>interact with MIDI controllers adding simple components in a form..
>
>
>I started implementing it like that
> * A global "Firmata" component with:
>
>   - A virtual "Firmata" control that Inherits SerialPort that is responsible for the communication through the serial port. It is completely configured graphically, and provides new functions (To send commands to Arduino) and events (To notify arduino event to others Controls) to interact with Arduino.
>
>   - Others controls Inherits UserControls. Eg: A FirmataSwitchButton to show the status of a digital input, or FirmataProgressBar to show a Analog Input.. Always responding to events of Firmata Control
>
>
>My idea is that it should be completely graphic, and the procedure would be like this:
>
> 1. Add a Firmata control.
> 2. Configure the control: ¡NAME!(Eg: "Firmata1"), port, baud, etc..
> 3. Add FirmataSwitchButton.
> 4. Configure the FirmataSwitchButton: Digital Pin to represent, but fundamentally the Firmata control used represented by the string property as "Firmata1"..
>
>
>Now, through the name I need to get the object Firmata configured to make controls interact with it.
>Why not make the controls inherit from Firmata? Because it would configure all controls individually.. The idea is to set up once, to use many.. ;)
>
>Anyone know how to do this?
>I found this[3], but it seems not work
>
>> Dim hFirmata As Firmata
>
>> hFirmata = Class["Firmata1"].Instance
>
>
>When running Gambas respond: "Is not a object".
>
>
>Regards,
>Matias.
>
>p.s: If this works could be extrapolated to MIDI fairly easy.. =)
>
>
>LINKS:
>
> [1] http://firmata.org/wiki/Main_Page
> [2] http://ctrlr.org/getting-started/
> [3] http://gambaswiki.org/wiki/comp/gb/class/instance
>
>------------------------------------------------------------------------------
>Site24x7 APM Insight: Get Deep Visibility into Application Performance
>APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>Monitor end-to-end web transactions and take corrective actions now
>Troubleshoot faster and improve end-user experience. Signup Now!
>http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list