[英]Arduino to PC Bluetooth Communication
I am using PIR motion sensor with Arduino Bluno (with Bluetooth module). 我将PIR运动传感器与Arduino Bluno(带有蓝牙模块)一起使用。 I want to send the the values of motion detected by the sensor from arduino to PC via Bluetooth. 我想通过蓝牙将传感器检测到的运动值从arduino发送到PC。
How may i get that on my PC? 我如何在我的PC上获取它? It can be of C++,C# or even Python. 它可以是C ++,C#甚至Python。 Shall be thankfull if anyone can help. 如果有人可以帮助,请多谢。
Here's my arduino code: 这是我的arduino代码:
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. 除非您特别希望直接接收PC,否则您可以使用另一种arduino接收打印到串行监视器。 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. 祝您一切顺利。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.