i strted a new project and open the serial port how can i now make the 13 leg to blink with a led
how do i use what to write in the main()
mayebe somone can send me a demo code
i strted a new project and open the serial port how can i now make the 13 leg to blink with a led
how do i use what to write in the main()
mayebe somone can send me a demo code
This would be a good place to start.
http://www.arduino.cc/playground/Interfacing/CPPWindows
Not sure how to blink a leg, though.
thx
but can i use console applucation insteed of clr
but can i use console applucation insteed of clr
Sure. The presence or absence of a GUI is immaterial.
ok so how do i start a console application for the arduino and waht is the proper syntex for it
like if i want to make a led to blink
ive tried that but it dident work who know the proper way how to make it work
#include <iostream>
#include "windows.h"
#include "stdlib.h"
using namespace std;
int main()
{
HANDLE test_port;
test_port = CreateFile(L"COM6",GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if(test_port==INVALID_HANDLE_VALUE)
{
if(GetLastError()==ERROR_FILE_NOT_FOUND)
{
cout<<"error 1 ";
}
cout<<"error 2 ";
}
DCB dcbSerialParams = {0};
// dcbSerial.DCBlength=sizeof(dcbSerialParams);
if (!GetCommState(test_port, &dcbSerialParams))
{
cout<< "error 3 ";
}
dcbSerialParams.BaudRate=CBR_9600;
dcbSerialParams.ByteSize=8;
dcbSerialParams.StopBits=ONESTOPBIT;
dcbSerialParams.Parity=NOPARITY;
if(!SetCommState(test_port, &dcbSerialParams))
{
cout<<"error 4 ";
}
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
CloseHandle(test_port);
return 0;
}
You can't use the C++ compiler to send source code to the Arduino, and expect it to do anything.
The source code for the Arduino needs to be compiled and linked, and the resulting hex file uploaded to the Arduino.
Then, the C++ compiler can be used to create a program that reads from and writes to the serial port that the Arduino is attached to and reading from and writing to.
can u pls suply sompice of code that can do it
if i understand the proper way to comunicate with the board i could take it from there
pleas help guys
iam loking for a demo code that runs from vs c++ consol application and make a led goes on and off
Try to take a look at the first message of this post:
thx ive got it now