hey guys,
i've received arduino uno , started c# project communicate it. i'm using arduino ide plugin visual studio, can have every projects same visual studio solution..
i managed send , receive data exemples want arduino sketch use object of c# class library. don't find way declare , use objects sketch program.
what have now:
boxcontrol_common assembly:
arduino sketch:
any tips declare , use arduinoservicerequest , arduinoserviceresponse in arduino sketch?
i've received arduino uno , started c# project communicate it. i'm using arduino ide plugin visual studio, can have every projects same visual studio solution..
i managed send , receive data exemples want arduino sketch use object of c# class library. don't find way declare , use objects sketch program.
what have now:
boxcontrol_common assembly:
code: (c#) [select]
namespace boxcontrol_common.service.arduino
{
public enum arduinoservicerequest
{
sayhello = 1,
sayhelloyou = 2
}
public class arduinoserviceresponse
{
public static string badrequest = "bad request";
public static string hello = "hello";
public static string helloyou = "hello you!";
//....
}
}
arduino sketch:
code: [select]
const int baud_rate = 9600;
const int delay = 100;
void setup()
{
serial.begin(baud_rate);
}
void loop()
{
if (serial.available() > 0)
{
switch (serial.parseint())
{
case arduinoservicerequest.sayhello:
sayhello();
break;
case arduinoservicerequest.sayhelloyou:
sayhelloyou();
break;
default:
serial.println(arduinoserviceresponse.badrequest);
break;
}
delay(delay);
}
}
void sayhello()
{
serial.println(arduinoserviceresponse.hello);
}
void sayhelloyou()
{
serial.println(arduinoserviceresponse.helloyou);
}
any tips declare , use arduinoservicerequest , arduinoserviceresponse in arduino sketch?
quote
but want arduino sketch use object of c# class librarynot going happen. arduino programmed in c++, not c#.
Arduino Forum > Using Arduino > Programming Questions > Using C# Class Library into sketch
arduino
Comments
Post a Comment