简体   繁体   中英

Arduino to PC Bluetooth Communication

I am using PIR motion sensor with Arduino Bluno (with Bluetooth module). I want to send the the values of motion detected by the sensor from arduino to PC via Bluetooth.

How may i get that on my PC? It can be of C++,C# or even Python. Shall be thankfull if anyone can help.

Here's my arduino code:

int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR     
int pirState = LOW;
char str1;// we start, assuming no motion detected
int val = 0;
volatile int count =0;// variable for reading the pin status

void setup() {

// pinMode(ledPin, OUTPUT);      // declare LED as output
Serial.begin(115200);
pinMode(inputPin, INPUT);     // declare sensor as input

attachInterrupt(digitalPinToInterrupt(2), pin_ISR,FALLING);
}

void pin_ISR() {

 count++;

Serial.write(Serial.print(count));
}

Unless you specifically want the pc to directly receive, you could use another arduino to receive an print to the serial monitor. You could then have a program collect and save what came into the serial monitor. Just a suggestion. It may be easier in the end. Good luck whatever you choose to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM