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

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


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




More information about the User mailing list