Menu Close
Spread the love

c++ arduino serial communication

 

Serial Communication with C++ Project. C++ windows application
with Arduino nano Communication Serial A photoresistor or light-dependent

 

Arduino Serial Comminucation

Communicating to the Arduino in the .NET platform is pretty much straightforward: The Arduino uses a virtual serial
port to allow programs to be written onto it, but we can also use this port to get and send data to and from the Arduino.

Parts Required:

  1. Arduino NANO
  2. LDR (1)
  3. LCD 16×2 (1)
  4. Wires to connect it all together

 

uper

#include <LiquidCrystal.h>

const int buttonPin = A2;
const int ledPin =  8;
int buttonState = 0;
int ledstat = 0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int sensorMin = 0;
const int sensorMax = 600;

void setup() {
pinMode(buttonPin, INPUT);

Serial.begin(9600);
lcd.begin(16, 2);
lcd.clear();
}

void loop() {

lcd.setCursor(0, 1);

int sr = analogRead(A2);
// map the sensor range to a range of four options:
int range = map(sr, 0, 1023, 0, 255);
lcd.print(sr);
delay(65);
lcd.clear();

if (sr < 5){
Serial.print(0);
}
else
Serial.println(1);

}

Down

 

For more Please make sure to subscribe to Officialhrm YouTube channel and like Facebook Page.

Thank you for visiting OfficialhrmPlease don’t forget to share this website with your friends.

Download

File Description Date added File size Downloads
zip Serial comminication with arduino August 15, 2018 4:27 pm 8 MB 6247
Posted in Arduino

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *