I made a C # application to control two servos via USB with Arduino.
When you pull the slider bar, the value is sent to the Arduino, which represent the positions of the servo.
Each servo has his own bar.
C# code :
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;
using System.Threading;
namespace SERIAL_ANALOG_WRITE
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void bara1_ValueChanged(object sender, EventArgs e)
{
val_bara1.Text = Convert.ToString(bara1.Value);
transmite1();
}
[... do you want the rest of the code???? ...]
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (serialPort1.IsOpen) serialPort1.Close();
}
}
}
Arduino code :
#include <Servo.h>
int v, v1, v2, v3, v4;
Servo servo1;
Servo servo2;
void setup()
{
servo1.attach(9);
servo2.attach(10);
Serial.begin(9600);
}
void loop()
{
if (Serial.available()>0)
{
[... bla-bla-bla...]
}
delay(10);
}
Hi. May I please have the code for my new project?
RăspundețiȘtergeregive me your email address!
ȘtergereHi. My email adress is:
Ștergerexyz.boy.28@googlemail.com
Thanks a lot!!! =)
Hi. May I please have the code for my new project?
RăspundețiȘtergereI'm very interested in C#, arduino and USB communication.
Hi, can i get the rest of code?
RăspundețiȘtergereMy email is:
mamretsptc@gmail.com
Hi,
RăspundețiȘtergereI am searching 2 servos motor at the same time?
Could you send to me codes arduino and c#?
best regards.
my email:
cengav4r@gmail.com
Sent. It's ok?
ȘtergereHi again,
RăspundețiȘtergereI tried your codes but i did not work on my platform.
If it is possible, Could you send to me C# Project file.
I send to you my files .Maybe you can see my fault.
best regards
Cenk
download link;
http://www.multiupload.nl/FYDZCRROXU
(I tried send this mail to your gmail but gmail gives error )
Acest comentariu a fost eliminat de autor.
RăspundețiȘtergereAcest comentariu a fost eliminat de autor.
RăspundețiȘtergereHi,
RăspundețiȘtergereyou have posted a beautiful example to Arduino c# communication.
Can i have a code. I'd like to try it.
zanzinot@yahoo.it
Brodo
Hello, can you send me code for this awesome project?
RăspundețiȘtergereqlukasq@o2.pl
I don't have my computer around. I'll send when I get home!
RăspundețiȘtergereHello, I'm working on a school project and I'm having trouble controlling servos via C# because they tend to move at the same time or in certain values they turn on other motors that should be off... could you share the codes? mastermike_520@hotmail.com
RăspundețiȘtergereHy!
ȘtergereI lost the codes, but if I can help it ....
C # application must first send '1 'to control the engine 1, followed by the desired angle or '2' command to drive 2, followed by the desired angle.
The Arduino code, according to the first digit received, it sends the command to the servo 1 or 2.