Skip to content

Instantly share code, notes, and snippets.

View manashmandal's full-sized avatar
👨‍💻
Probably Coding || ! Probably Coding

Manash Kumar Mandal manashmandal

👨‍💻
Probably Coding || ! Probably Coding
View GitHub Profile
#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>
#include "SerialPort.h"
SerialPort::SerialPort(char *portName)
{
this->connected = false;
this->handler = CreateFileA(static_cast<LPCSTR>(portName),
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
//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;
#define BAUD 9600
void setup(){
Serial.begin(BAUD);
}
void loop(){
Serial.println("Hello From Arduino");
delay(5000);
}
#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];
//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);
TEMPLATE = app
CONFIG += console c++14
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += %{CppFileName}
{
"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}",
{
"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}",
#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[])
{