Bien de momento solo voy a escribir que estoy trabajando en un proyecto para la academia a fin de tener una interfaz para el Rally Mecatronico en su versión 5, donde usando MySQL, Gambas2 y Pinguino se vidualizará un tablero de resultados.!!
Aquí una imagen
:D
Blog cajón desastre (CBTis 44 / TecNM Teziutlán) https://github.com/maigke ( tiene muy poca aportación)
Mostrando entradas con la etiqueta BASIC. Mostrar todas las entradas
Mostrando entradas con la etiqueta BASIC. Mostrar todas las entradas
martes, 9 de abril de 2013
domingo, 20 de septiembre de 2009
Tlacotli primeras pruebas
:D Hoy estoy muy contento ya que ayer probamos 3 servos del proyecto Tlacotli (si ves la barra lateral ahi esta una foto junto con otros proyectos) pero ahora ya con un nuevo mecanismo de soporte y ademas el manejo del mismo, aqui les dejo el video
Pruebas con GAMBAS y el Puerto Serie desde SSH
Buenos días!!, aqui posteando esto, pues ya finalizaron las pruebas que estaba haciendo con Gambas 2 y el puerto Serial, el día de ayer probamos la aplicacion desarrollada, en una Desktop y por medio de ssh en modo gráfico accedimos al server, desde una lap.
La respuesta del micro que esta conectado al puerto serial, responde al caracter enviado colocando en el textArea correspondiente S_1 + o S_1 - segun sea el caso de avance o retroceso en la posicion del servomotor, pero bueno ahora colocaremos el video y algunas notas que postee en el Foro de PIC Linux
Bueno aqui estan ya las correcciones
http://www.filefactory.com/file/a0a2a6h/n/mmm-testserial_0_0_5_orig_tar_gz
y bueno un video de como funciona ya este programa

Para grabar el escritorio use gtk-RecordMyDesktop y para los acercamientos use un efecto de Compiz Fusion
para convertir los videos a .AVI que genera el gtk-RecordMyDesktop use la consola con el mencoder, muy bueno, muy rápido y sencillo, el comando usado fue
mike@mike:~$ mencoder testRS232viaSSh.ogv -o testRS232viaSSh.avi -oac mp3lame -ovc lavc
Saludos!!
La respuesta del micro que esta conectado al puerto serial, responde al caracter enviado colocando en el textArea correspondiente S_1 + o S_1 - segun sea el caso de avance o retroceso en la posicion del servomotor, pero bueno ahora colocaremos el video y algunas notas que postee en el Foro de PIC Linux
Bueno aqui estan ya las correcciones
http://www.filefactory.com/file/a0a2a6h/n/mmm-testserial_0_0_5_orig_tar_gz
y bueno un video de como funciona ya este programa
Para grabar el escritorio use gtk-RecordMyDesktop y para los acercamientos use un efecto de Compiz Fusion
para convertir los videos a .AVI que genera el gtk-RecordMyDesktop use la consola con el mencoder, muy bueno, muy rápido y sencillo, el comando usado fue
mike@mike:~$ mencoder testRS232viaSSh.ogv -o testRS232viaSSh.avi -oac mp3lame -ovc lavc
Saludos!!
sábado, 12 de septiembre de 2009
Codigo Fuente para control de servos por RS232 Gambas
Re: GAMBAS Almenos es basic- Puerto Serie - PIC16F628A
maigke el Lun 7 Sep 2009 - 19:39
- Código:
' Gambas class file
'Variables Globales
PUBLIC flag1 AS Boolean = FALSE
PUBLIC flag2 AS Boolean = FALSE
PUBLIC fTermine AS Boolean = FALSE ' bandera para indicar que ya acabo de mover un servo
'Variables para posicionamiento
PUBLIC S1Pos1 AS Integer PUBLIC S2Pos1 AS Integer PUBLIC S3Pos1 AS Integer PUBLIC S4Pos1 AS Integer
PUBLIC S5Pos1 AS Integer
PUBLIC S1Pos2 AS Integer PUBLIC S2Pos2 AS Integer PUBLIC S3Pos2 AS Integer PUBLIC S4Pos2 AS Integer
PUBLIC S5Pos2 AS Integer
'Variables para HOME
PUBLIC s1 AS Integer PUBLIC s2 AS Integer PUBLIC s3 AS Integer PUBLIC s4 AS Integer PUBLIC s5 AS Integer
PUBLIC vini1 AS Integer PUBLIC vfin1 AS Integer PUBLIC vini2 AS Integer PUBLIC vfin2 AS Integer PUBLIC vini3 AS Integer
PUBLIC vfin3 AS Integer PUBLIC vini4 AS Integer PUBLIC vfin4 AS Integer PUBLIC vini5 AS Integer PUBLIC vfin5 AS Integer
PUBLIC tempo AS Integer
PUBLIC SUB Form_Close()
IF ttyUSB.Status = Net.Active THEN CLOSE ttyUSB
END
'***************************Seccion para la comunicacion del puerto serial
'Esta parte es bastante modificable
PUBLIC SUB Check_Status()
ChkDSR.Value = ttyUSB.DSR
ChkDTR.Value = ttyUSB.DTR
ChkCTS.Value = ttyUSB.CTS
ChkRTS.Value = ttyUSB.RTS
ChkDCD.Value = ttyUSB.DCD
ChkRNG.Value = ttyUSB.RNG
END
PUBLIC SUB Form_Open()
cmdVelocidad.Index = cmdVelocidad.Find("115200") 'Lo que sigue no es valido separa las lineas indicadas por ';'
vini1 = 0; vfin1 = 0; vini2 = 0; vfin2 = 0; vini3 = 0; vfin3 = 0; vini4 = 0; vfin4 = 0; vini5 = 0; vfin5 = 0; sldS1.Value = 250
sldS2.Value = 250; sldS3.Value = 250; sldS4.Value = 250; sldS5.Value = 250
END
PUBLIC SUB Button1_Click()
ME.Close
END
PUBLIC SUB cmdAbreCierra_Click()
IF ttyUSB.Status = Net.Active THEN
CLOSE ttyUSB
cmdAbreCierra.Text = "Abre"
ELSE
'Linea de parametros
ttyUSB.PortName = txtPortText.Text
ttyUSB.Speed = cmdVelocidad.Text
ttyUSB.Parity = cmbParidad.Index
ttyUSB.DataBits = cmbDataBits.Text
ttyUSB.FlowControl = cmbControlFlujo.Index
ttyUSB.StopBits = cmbBitParo.Text
ttyUSB.Open()
Check_Status()
TextArea1.Text = "Puerto Abierto : " & ttyUSB.PortName & " Ajustes : " &
ttyUSB.Speed & " , " & ttyUSB.Parity & " , " & ttyUSB.DataBits & " , " &
ttyUSB.StopBits & " , " & Chr(13) & Chr(10)
cmdAbreCierra.Text = "Cierra"
ENDIF
END
'Funcion para leer puerto serial RS232
PUBLIC SUB ttyUSB_Read()
DIM s AS String
IF TabStrip1.Text = "Configuracion" THEN
READ #ttyUSB, s, Lof(ttyUSB)
TextArea1.Text = TextArea1.Text & s
ELSE IF TabStrip1.Text = "Servo 1" THEN
READ #ttyUSB, s, Lof(ttyUSB)
TextArea2.Text = TextArea2.Text & s
ELSE IF TabStrip1.text = "Servo 2" THEN
READ #ttyUSB, s, Lof(ttyUSB)
TextArea3.Text = TextArea3.Text & s
ELSE IF TabStrip1.Text = "Servo 3" THEN
READ #ttyUSB, s, Lof(ttyUSB)
TextArea4.Text = TextArea4.text & s
ELSE IF TabStrip1.Text = "Servo 4" THEN
READ #ttyusb, s, Lof(ttyUSB)
TextArea5.Text = TextArea5.text & s
ELSE IF TabStrip1.Text = "Servo 5" THEN
READ #ttyUSB, s, Lof(ttyUSB)
TextArea6.Text = TextArea6.Text & s
ENDIF
END
PUBLIC SUB ttyUSB_RNGChange(ival AS Boolean)
ChkRNG.Value = ival
END
PUBLIC SUB ttyUSB_DTRChange(ival AS Boolean)
ChkDTR.Value = ival
END
PUBLIC SUB ttyUSB_DSRChange(ival AS Boolean)
ChkDSR.Value = ival
END
PUBLIC SUB ttyUSB_CTSChange(ival AS Boolean)
ChkCTS.Value = ival
END
PUBLIC SUB ttyUSB_DCDChange(ival AS Boolean)
ChkDCD.Value = ival
END
PUBLIC SUB ttyUSB_RTSChange(ival AS Boolean)
ChkRTS.Value = ival
END
PUBLIC SUB ChkDTR_Click()
ttyUSB.DTR = ChkDTR.Value
Check_Status
END
PUBLIC SUB ChkRTS_Click()
ttyUSB.RTS = ChkRTS.Value
Check_Status
END
PUBLIC SUB cmbControlFlujo_Click()
ttyUSB.FlowControl = cmbControlFlujo.Index
END- Esta parte es la que envia los datos a los
seisservos upps, ¿de cuál fumé? si son solo 5 - Código:
'************************************************************************************************
PUBLIC SUB cmdAtras_Click()
IF ttyUSB.Status = Net.Inactive THEN
Message("Primero abre el Puerto")
ELSE
PRINT #ttyUSB, "a"
ToolButton2.Background = &FF0000&
ToolButton2.Text = "A"
WAIT 0.3 'Este retardo es para el parpadeo, entre colores, pero no tiene mucho caso
ToolButton2.BackColor = &00FF00&
ToolButton2.Text = ""
ENDIF
END
PUBLIC SUB cmdAdelante_Click()
IF ttyUSB.Status = Net.Inactive THEN
Message("Primero abre el puerto")
ELSE
PRINT #ttyUSB, "11"
ToolButton1.Background = &FF0000&
ToolButton1.Text = "1"
WAIT 0.3
ToolButton1.Background = &00FF00&
ToolButton1.text = ""
ENDIF
END
'**************************************************************************
'Control del primer servo
'Para el envio de datos, fue probada la tarjeta con varios valores
'en el tiempo medido por osciloscopio, cuando la tarjeta es reiniciada
'con escala de 0.5ms por division, el tiempo en alto esta establecido a 1500ms
'tomado este valor como referencia, el slider y el spinbox, tienen el valor de
'250 de forma inicial, ya fueron medidos los tiempos de forma repetida, para
'verificar la presición del numero de datos enviados a la tarjeta.
PUBLIC SUB spnboxS1_Change()
DIM maximo AS Integer
DIM i AS Integer
sldS1.Value = spnboxS1.Value
vfin1 = spnboxS1.Value
tempo = 0
tempo = Abs(vfin1 - vini1)
'TextArea2.Text = "Vini1=" & vini1 & " Vfin1= " & vfin1 & " ciclo= " & tempo
'wait 1
IF (vfin1 - vini1) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "AAA"
ToolButton2.Background = &FF0000&
ToolButton2.Text = "A"
WAIT 0.1 'Este retardo es importante, ya que la tarjeta no responde muy rápido
ToolButton2.BackColor = &00FF00&
ToolButton2.Text = ""
NEXT
maximo = 0
ELSE
ENDIF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "111"
ToolButton1.Background = &FF0000&
ToolButton1.Text = "1"
WAIT 0.1
ToolButton1.Background = &00FF00&
ToolButton1.text = ""
NEXT
maximo = 0
ELSE
ENDIF
ENDIF
vini1 = vfin1
tempo = 0
fTermine = TRUE
END
'**********************************************************************************
PUBLIC SUB sldS1_Change()
DIM maximo AS Integer
DIM i AS Integer
spnboxS1.Value = sldS1.Value
vfin1 = spnboxS1.Value
tempo = 0
tempo = Abs(vfin1 - vini1)
'TextArea2.Text = "Vini1=" & vini1 & " Vfin1= " & vfin1 & " ciclo= " & tempo
'WAIT 1
IF (vfin1 - vini1) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "A"
ToolButton2.Background = &FF0000&
ToolButton2.Text = "A"
WAIT 0.1
ToolButton2.BackColor = &00FF00&
ToolButton2.Text = ""
NEXT
maximo = 0
ELSE
ENDIF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "1"
ToolButton1.Background = &FF0000&
ToolButton1.Text = "1"
WAIT 0.1
ToolButton1.Background = &00FF00&
ToolButton1.text = ""
NEXT
maximo = 0
ELSE
ENDIF
ENDIF
vini1 = vfin1
tempo = 0
fTermine = TRUE
END
'***********************************************************************************
'Control del segundo servo
PUBLIC SUB spnboxS2_Change()
DIM maximo AS Integer
DIM i AS Integer
sldS2.Value = spnboxS2.Value
vfin2 = spnboxS2.Value
tempo = 0
tempo = Abs(vfin2 - vini2)
'Usese solo en caso de que olvide el cable de comicacion como a mi me paso :(
'TextArea3.Text = "Vini2=" & vini2 & " Vfin2= " & vfin2 & " ciclo= " & tempo
' WAIT 1
IF (vfin2 - vini2) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "B"
ToolButton3.Background = &FF0000&
ToolButton3.Text = "B"
WAIT 0.1 'Este retardo es importante, ya que la tarjeta no responde muy rápido
ToolButton4.BackColor = &00FF00&
ToolButton4.Text = ""
NEXT
maximo = 0
ELSE
ENDIF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "2"
ToolButton1.Background = &FF0000&
ToolButton1.Text = "2"
WAIT 0.1
ToolButton1.Background = &00FF00&
ToolButton1.text = ""
NEXT
maximo = 0
ELSE
ENDIF
ENDIF
vini2 = vfin2
tempo = 0
END
'**********************************************************************************
PUBLIC SUB sldS2_Change()
DIM maximo AS Integer
DIM i AS Integer
spnboxS2.Value = sldS2.Value
vfin2 = spnboxS2.Value
tempo = 0
tempo = Abs(vfin2 - vini2)
IF (vfin2 - vini2) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "B"
ToolButton2.Background = &FF0000&
ToolButton2.Text = "B"
WAIT 0.1
ToolButton2.BackColor = &00FF00&
ToolButton2.Text = ""
NEXT
maximo = 0
ELSE
ENDIF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "1"
ToolButton2.Background = &FF0000&
ToolButton2.Text = "1"
WAIT 0.1
ToolButton2.Background = &00FF00&
ToolButton2.text = ""
NEXT
maximo = 0
ELSE
ENDIF
ENDIF
vini2 = vfin2
tempo = 0
fTermine = TRUE
END
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'Control del tercer servo
PUBLIC SUB spnboxS3_Change()
DIM maximo AS Integer
DIM i AS Integer
sldS3.value = spnboxS3.Value
vfin3 = spnboxS3.Value
tempo = 0
tempo = Abs(vfin3 - vini3)
IF (vfin3 - vini3) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "C"
ToolButton5.BackColor = &FF0000&
ToolButton5.Text = "C"
WAIT 0.1
ToolButton5.BackColor = &00FF00&
ToolButton5.Text = ""
NEXT
maximo = 0
ELSE
END IF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "3"
ToolButton6.BackColor = &FF0000&
ToolButton6.Text = "3"
WAIT 0.1
ToolButton6.BackColor = &00FF00&
ToolButton6.Text = ""
NEXT
maximo = 0
ENDIF
END IF
vini3 = vfin3
tempo = 0
fTermine = TRUE
END
PUBLIC SUB sldS3_Change()
DIM maximo AS Integer
DIM i AS Integer
spnboxS3.value = sldS3.Value
vfin3 = sldS3.Value
tempo = 0
tempo = Abs(vfin3 - vini3)
IF (vfin3 - vini3) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "C"
ToolButton5.BackColor = &FF0000&
ToolButton5.Text = "C"
WAIT 0.1
ToolButton5.BackColor = &00FF00&
ToolButton5.Text = ""
NEXT
maximo = 0
ELSE
END IF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "3"
ToolButton6.BackColor = &FF0000&
ToolButton6.Text = "3"
WAIT 0.1
ToolButton6.BackColor = &00FF00&
ToolButton6.Text = ""
NEXT
maximo = 0
ENDIF
END IF
vini3 = vfin3
tempo = 0
fTermine = TRUE
END
'***********************************************************************************************************
'Control del 4to servo
PUBLIC SUB spnboxS4_Change()
DIM maximo AS Integer
DIM i AS Integer
sldS4.value = spnboxS4.Value
vfin4 = spnboxS4.Value
tempo = 0
tempo = Abs(vfin4 - vini4)
IF (vfin4 - vini4) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "D"
ToolButton7.BackColor = &FF0000&
ToolButton7.Text = "D"
WAIT 0.1
ToolButton7.BackColor = &00FF00&
ToolButton7.Text = ""
NEXT
maximo = 0
ELSE
END IF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "4"
ToolButton8.BackColor = &FF0000&
ToolButton8.Text = "4"
WAIT 0.1
ToolButton8.BackColor = &00FF00&
ToolButton8.Text = ""
NEXT
maximo = 0
ENDIF
END IF
vini4 = vfin4
tempo = 0
fTermine = TRUE
END
PUBLIC SUB sldS4_Change()
DIM maximo AS Integer
DIM i AS Integer
spnboxS4.value = sldS4.Value
vfin4 = sldS4.Value
tempo = 0
tempo = Abs(vfin4 - vini4)
IF (vfin4 - vini4) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "D"
ToolButton7.BackColor = &FF0000&
ToolButton7.Text = "D"
WAIT 0.1
ToolButton7.BackColor = &00FF00&
ToolButton7.Text = ""
NEXT
maximo = 0
ELSE
END IF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "4"
ToolButton8.BackColor = &FF0000&
ToolButton8.Text = "4"
WAIT 0.1
ToolButton8.BackColor = &00FF00&
ToolButton8.Text = ""
NEXT
maximo = 0
ENDIF
END IF
vini4 = vfin4
tempo = 0
fTermine = TRUE
END
'***********************************************************************************************************
'control Servo 5
PUBLIC SUB spnboxS5_Change()
DIM maximo AS Integer
DIM i AS Integer
sldS5.value = spnboxS5.Value
vfin5 = spnboxS5.Value
tempo = 0
tempo = Abs(vfin5 - vini5)
IF (vfin5 - vini5) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "E"
ToolButton9.BackColor = &FF0000&
ToolButton9.Text = "E"
WAIT 0.1
ToolButton9.BackColor = &00FF00&
ToolButton9.Text = ""
NEXT
maximo = 0
ELSE
END IF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "5"
ToolButton10.BackColor = &FF0000&
ToolButton10.Text = "5"
WAIT 0.1
ToolButton10.BackColor = &00FF00&
ToolButton10.Text = ""
NEXT
maximo = 0
ENDIF
END IF
vini5 = vfin5
tempo = 0
fTermine = TRUE
END
PUBLIC SUB sldS5_Change()
DIM maximo AS Integer
DIM i AS Integer
spnboxS5.value = sldS5.Value
vfin5 = sldS5.Value
tempo = 0
tempo = Abs(vfin5 - vini5)
IF (vfin5 - vini5) < 0 THEN
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "E"
ToolButton9.BackColor = &FF0000&
ToolButton9.Text = "E"
WAIT 0.1
ToolButton9.BackColor = &00FF00&
ToolButton9.Text = ""
NEXT
maximo = 0
ELSE
END IF
ELSE
IF ttyUSB.Status = Net.Active THEN
maximo = tempo
FOR i = 1 TO maximo
PRINT #ttyUSB, "5"
ToolButton10.BackColor = &FF0000&
ToolButton10.Text = "5"
WAIT 0.1
ToolButton10.BackColor = &00FF00&
ToolButton10.Text = ""
NEXT
maximo = 0
ENDIF
END IF
vini5 = vfin5
tempo = 0
fTermine = TRUE
END
'***********************************************************************************************************- La última parte del código borra los textareas y manda a posicionar al servo, aqui hay una parte importante con un ciclo while - wend, y tiene mucho que ver la bandera que puse en cada seccion de movimiento de servos, ya que sin esta bandera no se saldría de dicho ciclo.
- Código:
'Area de borrados de textAreas, cada text area solo contendra la info necesaria para su propio servo
PUBLIC SUB cmdBorrar_Click()
TextArea2.Text = ""
END
PUBLIC SUB Button2_Click()
TextArea3.Text = ""
END
PUBLIC SUB Button3_Click()
TextArea4.Text = ""
END
PUBLIC SUB Button4_Click()
TextArea5.Text = ""
END
PUBLIC SUB Button5_Click()
TextArea6.Text = ""
END
'Rutina de grabar las posiciones de los servos
PUBLIC SUB cmdGrabar_Click()
IF flag1 = FALSE AND flag2 = FALSE THEN
cmdGrabar.Text = "Grabar"
S1Pos1 = spnboxS1.Value
S2Pos1 = spnboxS2.Value
S3Pos1 = spnboxS3.Value
S4Pos1 = spnboxS4.Value
S5Pos1 = spnboxS5.Value
flag1 = TRUE
ELSE IF flag1 = TRUE AND flag2 = FALSE THEN
S1Pos2 = spnboxS1.Value
S2Pos2 = spnboxS2.Value
S3Pos2 = spnboxS3.Value
S4Pos2 = spnboxS4.Value
S5Pos2 = spnboxS5.Value
flag2 = TRUE
ELSE
Message.Error("Solo dos posiciones")
cmdGrabar.Text = "Borra"
S1Pos1 = 0
S1Pos2 = 0
S2Pos1 = 0
S2Pos2 = 0
S3Pos1 = 0
S3Pos2 = 0
S4Pos1 = 0
S4Pos2 = 0
S5Pos1 = 0
S5Pos2 = 0
flag1 = FALSE
flag2 = FALSE
END IF
END
PUBLIC SUB cmdHome_Click()
s1 = spnboxS1.Value
s2 = spnboxS2.Value
s3 = spnboxS3.Value
s4 = spnboxS4.Value
s5 = spnboxS5.Value
TextArea1.text = "Home ha sido selecionado con las siguientes
posiciones " & s1 & " " & s2 & " " & s3 & " "
& s4 & " " & s5
'TabStrip1.Action =
END
PUBLIC SUB ToolButton11_Click()
'Ir a home
'Colocamos una bandera que se llama fTermine que nos indica si un ciclo de envio de datos ya termino
' ahora preguntamos si los valores del spinbox y del valor dado como home son iguales
' esto pasa si un eje no lo mueves desde un inicio, en caso de ser cierto, pues entonces
' no hace nada, ya que si no se pone el if por alguna razon entra en un bucle infinito
' si los valores actuales del spinbox y de la pos de home no son iguales,
' mandamos a modificar ahora el valor del spinbox, enviando los correspondientes
' a través del puerto serial
fTermine = FALSE
IF (spnboxS1.Value <> s1) THEN
spnboxS1.Value = s1
WHILE fTermine = FALSE
WEND
END IF
fTermine = FALSE
IF (spnboxS2.Value <> s2) THEN
spnboxS2.Value = s2
WHILE fTermine = FALSE
WEND
END IF
fTermine = FALSE
IF (spnboxS3.Value <> s3) THEN
spnboxS3.Value = s3
WHILE fTermine = FALSE
WEND
END IF
fTermine = FALSE
IF (spnboxS4.Value <> s4) THEN
spnboxS4.Value = s4
WHILE fTermine = FALSE
WEND
END IF
fTermine = FALSE
IF (spnboxS5.Value <> s5) THEN
spnboxS5.Value = s5
WHILE fTermine = FALSE
WEND
END IF
'Ir a la posicion 1
'Ir a la posicion 2
'Regresar a home
END
Gambas primeras pruebas con el nuevo software
Hola a todos!!, bueno aqui estoy dando avances del proyecto que llevamos
, bueno pues he seguido trabajando con GAMBAS con el Puerto serial y con un adaptador USB-RS232, el cual en el post anterior mencione que me funcionaba muy bien!!, bueno, pues les comento que el anterior interfaz tuve que abandonarla ya que no me gusto mucho y se revolvio todo el codigo
, sin embargo decidi comenzar casi desde cero con la interfaz, pero basandome en los códigos anteriores que puse al inicio de este hilo y de los ejemplos que he estado haciendo.
Bueno ahora en lugar de un solo panel colocamos un panelStrip que son las solapas o pestañas, para que en cada una de ellas estuviera el control de un servomotor, controlando el ancho del pulso por medio del envio de caracteres ascii, a través de un spinbox y de un slider, pero ahora ya mas separado, con un textArea, donde se puede visualizar la respuesta del micro, unos botones que puse como indicadores LEDs ( bueno simulandolos
) y pues por el momento un grabado de posicionado home.
Ya medimos los anchos de pulsos con un oscilosocipio y la variacion que tiene es muy aceptable, digamos unos 20us de variacion de ancho de pulso, pero como estos servo, van a unos engranajes un tanto grandes, esta variacion no me perjudica mucho, bueno esta respuesta es empirica aun, luego nos meteremos con los numeritos
Lo que aun nos falta, es que grabe mas posiciones, que sea mas raṕido, bueno eso por el momento no creo que sea posible debido al
formato de datos que acepta el micro, luego lo reprogramamos, que este mas bonita la GUI, mmmm y bueno las sugerencias que me hagan favor de hacerme.
Una disculpa de antemano si no coloco imagenes, pero aqui esta retringido el servicio de internet y todo lo que es multimedia, no pasa, si alguien me sugiere el uso de TOR y privoxy se lo agradezco, pero realmente no quiero romper las politicas ya que me dejarian sin servicio al localizarme, ademas de que seria facil ya que sus servidores Linux esta bien configgurados.
Las imagenes las colacaré al rato cuando esté en casa. Les coloco de mientras el código
Me dice que el post es muy largo!!!
Bueno ahora en lugar de un solo panel colocamos un panelStrip que son las solapas o pestañas, para que en cada una de ellas estuviera el control de un servomotor, controlando el ancho del pulso por medio del envio de caracteres ascii, a través de un spinbox y de un slider, pero ahora ya mas separado, con un textArea, donde se puede visualizar la respuesta del micro, unos botones que puse como indicadores LEDs ( bueno simulandolos
Ya medimos los anchos de pulsos con un oscilosocipio y la variacion que tiene es muy aceptable, digamos unos 20us de variacion de ancho de pulso, pero como estos servo, van a unos engranajes un tanto grandes, esta variacion no me perjudica mucho, bueno esta respuesta es empirica aun, luego nos meteremos con los numeritos
Lo que aun nos falta, es que grabe mas posiciones, que sea mas raṕido, bueno eso por el momento no creo que sea posible debido al
formato de datos que acepta el micro, luego lo reprogramamos, que este mas bonita la GUI, mmmm y bueno las sugerencias que me hagan favor de hacerme.
Una disculpa de antemano si no coloco imagenes, pero aqui esta retringido el servicio de internet y todo lo que es multimedia, no pasa, si alguien me sugiere el uso de TOR y privoxy se lo agradezco, pero realmente no quiero romper las politicas ya que me dejarian sin servicio al localizarme, ademas de que seria facil ya que sus servidores Linux esta bien configgurados.
Las imagenes las colacaré al rato cuando esté en casa. Les coloco de mientras el código
jueves, 6 de agosto de 2009
gambas otro paquete deb y sliders
Advertencia.- Todos estos mensajes sobre gambas, los estoy realizando desde un foro, denominado foro activo, que trata sobre programación de electrónica desde entornos linux, además si desean consultarla, solo deben registrarse, esta muy buena, la recomiendo.
**************************************************************************************
Buena noche compañeros listeros, bien ahora presento otro programa hecho en gambas, se que pensaran que esta parte que estoy publicando no corresponde, sin embargo les pido paciencia 
Bien esta vez se trata de como manejar controles slider + control spinbox haciendo que un background de un picturebox cambie de color, bien es cierto que tome como referencia el codigo fuente publicado en esta pagina, http://blog.ihtoa.org/2008/07/08/gambas-introduccion/ , a quien agradezco que haya colocado su codigo, sin el cual por el momento no me seria posible haber avanzado mas
.
bien AQUI coloco el paquete .deb
ahora AQUII coloco el codigo fuente -- Para que veas las propiedades aqui vienen

El codigo fuente esta aqui
************************************************************************************
veamos como irá quedando nuestro proyecto y tambien espero que a alguien del foro que se vaya interesando en usar GAMBAS, le sirvan estas breves notas como referencia y ayuda.
Gracias por su atencion
**************************************************************************************
Bien esta vez se trata de como manejar controles slider + control spinbox haciendo que un background de un picturebox cambie de color, bien es cierto que tome como referencia el codigo fuente publicado en esta pagina, http://blog.ihtoa.org/2008/07/08/gambas-introduccion/ , a quien agradezco que haya colocado su codigo, sin el cual por el momento no me seria posible haber avanzado mas
bien AQUI coloco el paquete .deb
ahora AQUII coloco el codigo fuente -- Para que veas las propiedades aqui vienen
El codigo fuente esta aqui
************************************************************************************
- Código:
' Gambas class file
' Esta basado en un ejemplo que tome de la siguiente pagina web
' http://www.nabble.com/Saber-que-boton-del-spinbox-se-ha-pulsado-td21523755.html
' http://blog.ihtoa.org/2008/07/08/gambas-introduccion/
PRIVATE FUNCTION Cambia_color()
'Esta funcion será llamada cada vez que nuestro slider cambie
PictureBox1.BackColor = Color.RGB(sldRojo.Value, sldVerde.Value, sldAzul.Value) ' le pone color al backG
txtMiColor.Text = "#" & Format$(sldRojo.Value, "00") & Format$(sldVerde.Value, "00") & Format$(sldAzul.Value, "00")
' Al textbox le imprime el valor del color que esta tanto en el slide, como en el spinboX
END
PUBLIC SUB sldRojo_Change()
Cambia_color()
spinRojo.Value = sldRojo.Value 'Cuando cambiamos el valor de slide tambien se asigna al spinner
END
PUBLIC SUB sldVerde_Change()
Cambia_color()
spinVerde.Value = sldVerde.Value
END
PUBLIC SUB sldAzul_Change()
Cambia_color()
spinAzul.Value = sldAzul.Value
END
PUBLIC SUB spinRojo_Change()
sldRojo.Value = spinRojo.Value 'Cuando cambiamos el valor del spinner tambien se cambia el del slide
Cambia_color()
END
PUBLIC SUB spinVerde_Change()
sldVerde.value = spinVerde.Value
Cambia_color()
END
PUBLIC SUB spinAzul_Change()
sldAzul.Value = spinAzul.Value
Cambia_color()
END- *************************************************************************************
veamos como irá quedando nuestro proyecto y tambien espero que a alguien del foro que se vaya interesando en usar GAMBAS, le sirvan estas breves notas como referencia y ayuda.
Gracias por su atencion
Suscribirse a:
Entradas (Atom)
