Go Down

Topic: arduino communicate with C++ (code blocks) (Read 964 times) previous topic - next topic


I have an Arduino and I would like to communicate with my computer. I would like to use usb (COM3) ( I think it is the easiest way). I use C++ ( Code Blocks) on my computer. I wan't to send an variable from computer to my arduino.

I've written the Arduino code:

// receiver
int data;

void setup() {
    pinMode (13, OUTPUT);

void loop() {
    if (Serial.available()) {
        data = Serial.read();
        if (data==1){
            digitalWrite(13, HIGH);
    digitalWrite(13, LOW);

I want to write the sender code in C++ ( Code Blocks) which send an variable (data=1) .

Can you help me?


Go Up