Go Down

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

Ecku01



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() {
    Serial.begin(9600);
    pinMode (13, OUTPUT);
}

void loop() {
    if (Serial.available()) {
        data = Serial.read();
        if (data==1){
            digitalWrite(13, HIGH);
            delay(100);
        }
    }
    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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy