Visual Basic Tutoriales: Arduino
Visual Basic Tutoriales: Arduino
ARDUINO ANDROID
APP
06- Captura de Sensor de Proximidad (PING) con Visual Basic INVENTOR APPINVENTOR ARDUINO
(VB.NET).Arduino ASP
COMUNICACION
CONEXION
CONTROL
DETECCION
DIBUJO
DRAWING
ESCRITORIO
Codigo: FISICA
VB.NET
GRAFICOS
Form1 GRAPHICS
IMAGEN
Public Class Form1 IMAGENES
INTERNET IP
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles LED
Button1.Click
Try
Button1.Visible = False
SerialPort1.PortName = TextBox3.Text MOVIMIENTO
SerialPort1.Open()
Timer1.Start()
NETWORKING
Catch ex As Exception
MsgBox(ex.Message) PANTALLA
Button1.Visible = True PILAS
End Try
End Sub
PUERTO SERIAL
ARDUINO
UDP
*/ USB VIDEO
VIDEOCAMARA VIDEOCONFERENCIA
// this constant won't change. It's the pin number VIDEOLLAMADA
// of the sensor's output: VIDEOVIGILANCIA
const int pingPin = 7; VOZ WEB
WEBCAM
void setup() {
// initialize serial communication:
Serial.begin(9600); Páginas
}
Página principal
void loop() ANDROID
{ ARDUINO
// establish variables for duration of the ping, BASE DATOS
// and the distance result in inches and centimeters: CHAT, WEBCAM
long duration, cm;
CHAT, VIDEOCONFERENCIA
CIENCIAS
// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
ESCRITORIO REMOTO 1
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(pingPin, OUTPUT); GRAFICOS
digitalWrite(pingPin, LOW); MISCELANEA
delayMicroseconds(2); MVB
digitalWrite(pingPin, HIGH); NETWORKING
delayMicroseconds(5); RECONOCIMIENTO DE VOZ
digitalWrite(pingPin, LOW); VBSCRIPT
// The same pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending Archivo del blog
// of the ping to the reception of its echo off of an object.
▼ 2014 (40)
pinMode(pingPin, INPUT);
► abril (4)
duration = pulseIn(pingPin, HIGH);
▼ marzo (17)
// convert the time into a distance Resaltar, Remarcar y Guardar el Texto
de un RichTe...
cm = microsecondsToCentimeters(duration); 08-Hablando con Arduino en Visual
Basic (VB.NET). ...
05- Imagenes del Escritorio en la Web
Serial.print(cm); con ASP y V...
Serial.println(); 07- Control Remoto (Via Web) de 3
Servos con Visua...
delay(1000); 04- Imagenes desde Webcam a Pagina
} Web con ASP y ...
03- Visualizador de Imagenes en la
long microsecondsToCentimeters(long microseconds) Web con ASP y V...
{ 02- Galeria de Imagenes en la Web con
// The speed of sound is 340 m/s or 29 microseconds per centimeter. ASP y Visual...
// The ping travels out and back, so to find the distance of the Conversor de Sistemas Numericos con
// object we take half of the distance travelled. Visual Basic (...
return microseconds / 29 / 2;
Informacion Basica de las Unidades de
} Memoria con ...
18- Copiar y Guardar Parte de una
Imagen con Visua...
Extraer USB (Pendrive) con Seguridad
05- LED Encendido mientras se presiona un Boton con Visual Basic (VB.NET) en VIsual Bas...
Activar y Desactivar el Firewall de
Se trata de una pequeña aplicacion que mantiene encendido un LED solo Windows7 con V...
mientras se presiona un boton.
UDP Basico con Visual Basic (VB.NET)
TCP Basico con Visual Basic (VB.NET)
06- Captura de Sensor de Proximidad
(PING) con Vis...
Visualizar la Señal de un Microfono
(Sonido) con V...
03- Jugando con el Reconocimiento de
Voz en Visual...
► febrero (14)
► enero (5)
► 2013 (69)
Datos personales
EGODISTONICO
VB.NET
Form1:
Try
SerialPort1.PortName = TextBox1.Text
SerialPort1.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
ARDUINO:
void setup ()
{
Serial.begin(9600);
pinMode(13,OUTPUT);
}
void loop()
{
int recibido;
recibido=Serial.read();
if(recibido== '1')
{
digitalWrite(13,HIGH);
}
else if (recibido=='0')
{
digitalWrite(13,LOW);
}
}
NOTA IMPORTANTE:
VB.NET
Form1
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
SerialPort1.Close()
SerialPort1.PortName = TextBoxPUERTO.Text
End Sub
Private Sub ButtonCONECTAR_Click(sender As Object, e As EventArgs)
Handles ButtonCONECTAR.Click
Try
SerialPort1.PortName = TextBoxPUERTO.Text
SerialPort1.Open()
ButtonCONECTAR.Enabled = False
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles
TrackBar1.Scroll
Try
End Sub
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
int recibido ;
void setup()
{
Serial.begin(9600);
servo1.attach(10);
servo2.attach(11);
servo3.attach(6);
servo4.attach(5);
servo1.write (90);
servo2.write (90);
servo3.write (90);
servo4.write (90);
}
void loop()
{
if (Serial.available() > 0) {
// lee el byte entrante:
recibido = Serial.read();
switch (recibido)
{
}
}
Codigos:
VB.NET
Form1
Try
If ButtonCONECTAR.Enabled = False Then
If TrackBar1.Value >= -180 And TrackBar1.Value <= -90 Then
SerialPort1.Write("0") '-180
ElseIf TrackBar1.Value > -90 And TrackBar1.Value <= 90 Then
SerialPort1.Write("1") '0
ElseIf TrackBar1.Value > 90 And TrackBar1.Value <= 180 Then
SerialPort1.Write("2") '180
End If
Label1.Text = TrackBar1.Value
Else
MsgBox("DEBES CONECTAR EL PUERTO")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
#include <Servo.h>
Servo servo1;
int angulo ;
int recibido ;
void setup()
{
servo1.attach(9);
Serial.begin(9600);
}
void loop()
{
if (Serial.available() > 0) {
// lee el byte entrante:
recibido = Serial.read();
switch (recibido)
{
ARDUINO: (POTENCIOMETRO )
#include <Servo.h>
Servo servo1;
int pot1=0;
int valor;
int valoranterior=0;
int diferencia;
int threshold=30;
void setup()
{
servo1.attach(9);
}
void loop()
{
valor=analogRead(pot1);
diferencia=valor-valoranterior;
if(diferencia <-threshold ||diferencia > threshold)
{
valoranterior=valor;
valor= map (valor,0,1023,0,179);
servo1.write(valor);
}
delay (10);
}
Codigo:
Form1
SerialPort1.PortName = TextBoxPUERTO.Text
SerialPort1.Open()
ButtonCONECTAR.Enabled = False
Timer1.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End If
Label1.Text = TrackBar1.Value
End Sub
End Class
ARDUINO
Serial.begin(9600);
}
switch (recibido)
{
case '0':brillo = 0;break;
case '1':brillo = 50;break;
case '2':brillo = 100;break;
case '3':brillo = 150;break;
case '4':brillo = 200;break;
case '5':brillo = 255;break;
}
analogWrite(led, brillo);
}
}
01- Encender y apagar un LED con Visual Basic (VB.NET).Arduino
Primer video de una serie dedicada al control de Arduino con Visual Basic.
Esta es la típica aplicación que permite encender y apagar un LED desde
VB.NET.
En el video se utiliza la aplicación Webcam como Videocámara Remota,
disponible en este Blog.
Codigo:
Form1:
End Sub
Private Sub ButtonENCENDER_Click(sender As Object, e As EventArgs)
Handles ButtonENCENDER.Click
SerialPort1.Write("1")
End Sub
Private Sub ButtonAPAGAR_Click(sender As Object, e As EventArgs)
Handles ButtonAPAGAR.Click
SerialPort1.Write("0")
End Sub
Private Sub Form1_FormClosing(sender As Object, e As
FormClosingEventArgs) Handles Me.FormClosing
SerialPort1.Close()
End Sub
End Class
ARDUINO
void setup ()
{
Serial.begin(9600);
pinMode(13,OUTPUT);
}
void loop()
{
int recibido;
recibido=Serial.read();
if(recibido== '1')
{
digitalWrite(13,HIGH);
}
else if (recibido=='0')
{
digitalWrite(13,LOW);
}
}
Recomendar esto en Google
No hay comentarios:
Publicar un comentario en la entrada
Introduce tu comentario...
Página principal
SPAM