簡體   English   中英

Arduino至PC藍牙通訊

[英]Arduino to PC Bluetooth Communication

我將PIR運動傳感器與Arduino Bluno(帶有藍牙模塊)一起使用。 我想通過藍牙將傳感器檢測到的運動值從arduino發送到PC。

我如何在我的PC上獲取它? 它可以是C ++,C#甚至Python。 如果有人可以幫助,請多謝。

這是我的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));
}

除非您特別希望直接接收PC,否則您可以使用另一種arduino接收打印到串行監視器。 然后,您可以讓一個程序收集並保存進入串行監視器的內容。 只是一個建議。 最終可能會更容易。 祝您一切順利。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM