This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SERIALPORT_H | |
#define SERIALPORT_H | |
#define ARDUINO_WAIT_TIME 2000 | |
#define MAX_DATA_LENGTH 255 | |
#include <windows.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SerialPort.h" | |
SerialPort::SerialPort(char *portName) | |
{ | |
this->connected = false; | |
this->handler = CreateFileA(static_cast<LPCSTR>(portName), | |
GENERIC_READ | GENERIC_WRITE, | |
0, | |
NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This code snippet will help you to read data from arduino | |
#include <iostream> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "SerialPort.h" | |
using std::cout; | |
using std::endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BAUD 9600 | |
void setup(){ | |
Serial.begin(BAUD); | |
} | |
void loop(){ | |
Serial.println("Hello From Arduino"); | |
delay(5000); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include "SerialPort.h" | |
using namespace std; | |
//String for getting the output from arduino | |
char output[MAX_DATA_LENGTH]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Default baud speed for communication | |
#define BAUD 9600 | |
//led | |
#define led 13 | |
//macro for on/off | |
#define on (digitalWrite(led, HIGH)) | |
#define off (digitalWrite(led, LOW)) | |
void setup(){ | |
Serial.begin(BAUD); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEMPLATE = app | |
CONFIG += console c++14 | |
CONFIG -= app_bundle | |
CONFIG -= qt | |
SOURCES += %{CppFileName} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"kind": "project", | |
"id": "R.Plain Cpp14 Application", | |
"category": "I.Projects", | |
"trDescription": "Creates a simple C++ application using either qmake, CMake, or Qbs to build.", | |
"trDisplayName": "Plain C++14 Application", | |
"trDisplayCategory": "Non-Qt Project", | |
"icon": "../../global/consoleapplication.png", | |
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"kind": "project", | |
"id": "R.Plain Cpp14 Application", | |
"category": "I.Projects", | |
"trDescription": "Creates a simple C++ application using either qmake, CMake, or Qbs to build.", | |
"trDisplayName": "Plain C++14 Application", | |
"trDisplayCategory": "Non-Qt Project", | |
"icon": "../../global/consoleapplication.png", | |
"enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
auto returnInt(void) { return 100; } | |
auto returnString(void) { return "Hello World"; } | |
auto returnDouble(void) { return 100.5; } | |
int main(int argc, char *argv[]) | |
{ |