c# interface & arduino mega 2560 r3
hi,
c# arayüzü ile f?rças?z motor manuel nas?l kontrol edebilirim.
c # how can check manual interface brushless motor.
example code:
#include <servo.h>
unsigned int control=0;
servo esc2;
int speedvalue;
int arm = 1000;
int steady = 300;
int initiate = 0;
void setup()
{
esc2.attach(9);
esc2.writemicroseconds(arm);
serial.begin(9600);
}
void loop()
{
if(serial.available()>0)
{
control=serial.read(); //first info recorded
//birinci motor - ba?latma
if(control=='r') //if r
{//?f arasi ser? port
if (initiate < 1)
{
throttleup();
initiate = 1;
}
if (initiate < 2)
{
for (int count = 0; count < 5; count++)
{
speedvalue = speedvalue + 50;
esc2.writemicroseconds(speedvalue);
control=0;
serial.println(speedvalue);
delay(1000);
}
initiate = 2;
}
esc2.detach();
//?f sonu ser? port
}
control=0;
}
}
//------------------------------------
void throttleup()
{
speedvalue = arm;
(int count = 0; count < steady; count++)
{
esc2.writemicroseconds(speedvalue);
speedvalue = speedvalue + 1;
serial.println(speedvalue);
delay(15);
}
}
c# arayüzü ile f?rças?z motor manuel nas?l kontrol edebilirim.
c # how can check manual interface brushless motor.
example code:
#include <servo.h>
unsigned int control=0;
servo esc2;
int speedvalue;
int arm = 1000;
int steady = 300;
int initiate = 0;
void setup()
{
esc2.attach(9);
esc2.writemicroseconds(arm);
serial.begin(9600);
}
void loop()
{
if(serial.available()>0)
{
control=serial.read(); //first info recorded
//birinci motor - ba?latma
if(control=='r') //if r
{//?f arasi ser? port
if (initiate < 1)
{
throttleup();
initiate = 1;
}
if (initiate < 2)
{
for (int count = 0; count < 5; count++)
{
speedvalue = speedvalue + 50;
esc2.writemicroseconds(speedvalue);
control=0;
serial.println(speedvalue);
delay(1000);
}
initiate = 2;
}
esc2.detach();
//?f sonu ser? port
}
control=0;
}
}
//------------------------------------
void throttleup()
{
speedvalue = arm;
(int count = 0; count < steady; count++)
{
esc2.writemicroseconds(speedvalue);
speedvalue = speedvalue + 1;
serial.println(speedvalue);
delay(15);
}
}
quote
c # how can check manual interface brushless motor.
i don't understand question. presumably, know how send data arduino, via serial port, , know how read data, on arduino, serial port.
have arduino write data of interest, whatever is, serial port, , read in application.
Arduino Forum > Using Arduino > Programming Questions > c# interface & arduino mega 2560 r3
arduino
Comments
Post a Comment