www.DreamRobotics.com 03.06.2009 tarihinden itibaren yayınına başlamıştır.
Siteye girmek için buraya tıklayın. veya www.dreamrobotics.com yazın..
Bora Ciner
Posted by : Bora Ciner | 3 Haziran 2009 Çarşamba | Published in
www.DreamRobotics.com 03.06.2009 tarihinden itibaren yayınına başlamıştır.
Siteye girmek için buraya tıklayın. veya www.dreamrobotics.com yazın..
Posted by : Bora Ciner | 20 Mayıs 2009 Çarşamba | Published in
Posted by : Bora Ciner | 19 Mayıs 2009 Salı | Published in
The Wii Remote, sometimes unofficially nicknamed "Wiimote", is the primary controller for Nintendo's Wii console. A main feature of the Wii Remote is its motion sensing capability, which allows the user to interact with and manipulate items on screen via movement and pointing through the use of accelerometer and optical sensor technology. Another feature is its expandability through the use of attachments.
Firstly we’re installing bluesoleil software from here ,then we press 1 and 2 buttons of wii remote at the same time, when we see the leds’ being blinking we connect to Wiiremote from bluesoleil program. It should see the device as an HID ( Human interface device) .
Now, We’re connected to Wiiremote from our pc via bluetooth connection.
Secondly, We’re configuring VS.Net with doing 3 steps.
1-) We select Project->Add Referance from our VS.Net 2008 project, in the Browse tab we select WiimoteLib.dll and add this .dll file to our project as an referance.
2-) In the begining of Form1.cs file we add this line in order to import the wiiremote library.
using WiimoteLib;
3-)The upper level of the public Form1() we add this line to create wiimote object
Wiimote wiimote1 = new Wiimote();
4-)Now we read the angular values of the wiiremote, put a button in the form and add these codes in that button.
wiimote1.Connect();
wiimote1.SetReportType(InputReport.IRAccel, true);
float xAccel = wiimote1.WiimoteState.AccelState.Values.X;
//acceleration value of the x axis
float yAccel = wiimote1.WiimoteState.AccelState.Values.Y;//y ekseninin ivmesel değeri
float zAccel = wiimote1.WiimoteState.AccelState.Values.Z;
now we have the values which we took from the wiiremote device.Finally , we want to see these on a label.
put a label on the form and append this line in the previous button.
label1.Text = xAccel.ToString();
When we press the button, it reads the values and display them on the label.
Posted by : Bora Ciner | | Published in
Oluşturmuş olduğumuz Form’a Wiimote kütüphanesini ve bağlantı kodlarını eklemiştik, şimdi de robot için hareketleri nasıl kalibre edip mikrodenetleyiciye gönderecğimizi anlayalım.
Öncelikle Wiimote change state fonksiyonunu kullamayacağız çünkü wiimote’daki değişim MCU-PC iletişim hızından daha hızlı olabilir, eğer böyle bir şey olursa da program hata verir. Bu yüzden bir Timer ekleyip hızını 100 (0.1s) ayarlayalım. içine de şu kodları ekleyelim
Uygulamadaki Kalibrasyon 0.2’dir
bool button_B = wiimote1.WiimoteState.ButtonState.B; /* A butonunun degeri*/
float xAccel = wiimote1.WiimoteState.AccelState.Values.X; /* X ekseni ivmesel değişkeni */
float yAccel = wiimote1.WiimoteState.AccelState.Values.Y;
float zAccel = wiimote1.WiimoteState.AccelState.Values.Z;
label23.Text = xAccel.ToString();
label29.Text = yAccel.ToString();
label30.Text = zAccel.ToString();
if (button_B == true)
{
label24.Text = "Button B Basili";
label33.Text = "Dur";
// if (port.IsOpen) port.WriteLine("5");
//else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
label35.Text = "Ates Ediliyor";
if (port.IsOpen) port.WriteLine("7");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
label24.Text = "Button B Basili Degil";
label35.Text = "Ates Edilmiyor";
if (yAccel > 0.2)
{
label33.Text = "Asagi";
if (port.IsOpen) port.WriteLine("4");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (yAccel < -0.2)
{
label33.Text = "Yukari";
if (port.IsOpen) port.WriteLine("3");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (xAccel > 0.2)
{
label33.Text = "Saga";
if (port.IsOpen) port.WriteLine("2");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (xAccel < -0.2)
{
label33.Text = "Sola";
if (port.IsOpen) port.WriteLine("1");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
label33.Text = "Dur";
if (port.IsOpen) port.WriteLine("5");
else MessageBox.Show("Serial port is closed!", "RS232 tester", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
}
Bu kodlar sayesinde hem ekranda robotun hangi komutu yerine getirdiğini görebiliyoruz hemde aynı anda o komutları göndererek robotu izleyebiliyoruz.
Not: Bu uygulamada form’a “port” adında bir serial port objesi eklenmiştir
(C) All Rights Reserved. Mikrodenetleyici Projeleri | Free blogger templates Designed by SkinPress.com