Hey guys, im fairly new to Arduino, and trying to interface it with Visual Studio C++
ive written a simple program with 2 buttons, one to turn off the LED, and one to turn on the LED.
the program sends a String to the arduino, which receives it and depending whether its L (on) or H (off) does w.e with it.
now im trying to implement a trackbar in the Form, with a value from 1-255, to control the PWM frequency on the arduino pin, hence changing the brightness of the LED.
the C++ code is as follows:
private: System::Void trackBar1_Scroll(System::Object^ sender, System::EventArgs^ e) {
trackBar1->Minimum = 1;
trackBar1->Maximum = 255;
this->Arduino->Open();
this->Arduino->Write(trackBar1->Value);
this->Arduino->Close();
}
but VS wont let me compile, giving the following error:
error C2664: 'void System::IO::Ports::SerialPort::Write(System::String ^)' : cannot convert parameter 1 from 'int' to 'System::String ^'
1> No user-defined-conversion operator available, or
1> No standard conversion exists from the boxed form of the arithmetic type to the target type
does anyone know how to send the int value through the serial port?
thanks for any help in advance