Hice un manual para del puerto serie controlado con Visual C# .net Express 2008. Al menos hay códigos que deseo pasarlo a Linux con MonoDevelop GTK# (C#).
El manual es este:
Ver manual
El código fuente al que deseo pasar a Linux es este (de la página 162 del manual):
Descargar FUENTE 1
Contraseña = D.P.E.
Si no pueden descargarlo, me avisan.
Necesito colaboradores para ampliar el manual. Por otra parte estoy pasándolo con Visual Basic y Visual C++ 2008.
Ver vídeo:
http://www.youtube.com/watch?v=niWAbQ-HVnY
Quiero que los usuarios de Windows, también entren a Linux y vean sus mismas posibilidades.
Un cordial saludo.
EDITO:
El código de Visual C# es este y quiero pasarlo a GTK# de MonoDevelop.
Código:
Dejo claro que el Visual C# uso un componente llamado serialPort1 en el que MonoDevelop no incluye. Ese es el problema que tengo. En Visual C# su configuración del componente serialPort1 está en la página 143 de este MANUAL.using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; namespace PicRS232 { public partial class Form1_Principal : Form { public Form1_Principal() { InitializeComponent(); // Abrir puerto mientra se ejecute la aplicación if (!serialPort1.IsOpen) { try { serialPort1.Open(); } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } } } private void button_t_Click(object sender, EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x74; //ASCII letra "t". serialPort1.Write(mBuffer, 0, mBuffer.Length); } private void button_b_Click(object sender, EventArgs e) { byte[] miBuffer = new byte[1]; miBuffer[0] = 0x62; //ASCII letra "b". serialPort1.Write(miBuffer, 0, miBuffer.Length); } private void button_a_Click(object sender, EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x61; //ASCII letra "a". serialPort1.Write(mBuffer, 0, mBuffer.Length); } private void button_l_Click(object sender, EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x6C; //ASCII letra "l". serialPort1.Write(mBuffer, 0, mBuffer.Length); } private void button_Espacio_Click(object sender, EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x20; //ASCII letra "Espacio". serialPort1.Write(mBuffer, 0, mBuffer.Length); } } }
Saludo.
EDITO 2:
Por ahora he lorgado esto.
Código:
// MainWindow.cs created with MonoDevelop // User: metaconta at 23:01 08/12/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using Gtk; using System.IO.Ports; // Añadir este using. public partial class MainWindow: Gtk.Window { public MainWindow (): base (Gtk.WindowType.Toplevel) { Build (); // Abrir puerto mientra se ejecute la aplicación if (!serialPort1.IsOpen) { try { serialPort1.Open(); } catch (System.Exception ex) { // MessageBox.Show(ex.ToString()); } } } protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } protected virtual void OnButtonTClicked (object sender, System.EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x74; //ASCII letra "t". serialPort1.Write(mBuffer, 0, mBuffer.Length); } protected virtual void OnButtonBClicked (object sender, System.EventArgs e) { byte[] miBuffer = new byte[1]; miBuffer[0] = 0x62; //ASCII letra "b". serialPort1.Write(miBuffer, 0, miBuffer.Length); } protected virtual void OnButtonAClicked (object sender, System.EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x61; //ASCII letra "a". serialPort1.Write(mBuffer, 0, mBuffer.Length); } protected virtual void OnButtonLClicked (object sender, System.EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x6C; //ASCII letra "l". serialPort1.Write(mBuffer, 0, mBuffer.Length); } protected virtual void OnButtonEspacioClicked (object sender, System.EventArgs e) { byte[] mBuffer = new byte[1]; mBuffer[0] = 0x20; //ASCII letra "Espacio". serialPort1.Write(mBuffer, 0, mBuffer.Length); } }