Robofun 機器人論壇
標題:
RX TX的問題
[打印本頁]
作者:
frty5566
時間:
2012-10-31 21:15
標題:
RX TX的問題
我用藍芽輸入訊號 是否有辦法可以在arduino 裡面看是什麼數值嗎
可否可以同時 輸出然後又輸入到同一塊板子
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int redLed = 9;
int greenLed = 10;
int blueLed = 11;
int sensorPin1 = 2;
int sensorPin2 = 3;
int sensorPin3 = 4;
int sensorValue1 = 0;
int sensorValue2 = 0;
int sensorValue3 = 0;
void setup()
{
Serial.begin(57600);
meetAndroid.registerFunction(red, 'r');
meetAndroid.registerFunction(green, 'g');
meetAndroid.registerFunction(blue, 'b');
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(blueLed, OUTPUT);
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, HIGH);
digitalWrite(blueLed, HIGH);
pinMode(sensorPin1, INPUT);
pinMode(sensorPin2, INPUT);
pinMode(sensorPin2, INPUT);
}
void loop()
{
meetAndroid.receive();
sensorValue1 = analogRead(sensorPin1);
sensorValue2 = analogRead(sensorPin2);
sensorValue3 = analogRead(sensorPin3);
Serial.print(sensorValue1);
Serial.print(sensorValue2);
Serial.print(sensorValue3);
}
void red(byte flag, byte numOfValues)
{
sensorValue1 = analogWrite(redLed, meetAndroid.getInt());
}
void green(byte flag, byte numOfValues)
{
sensorValue2 = analogWrite(greenLed, meetAndroid.getInt());
}
void blue(byte flag, byte numOfValues)
{
sensorValue3 = analogWrite(blueLed, meetAndroid.getInt());
}
sensorValue 是我想印出藍芽接收到的數值
可是Serial Monitor 不知道要調成什麼才能看
然後想要跑到 analog 2. 3 .4 做輸入
不知道是否可行
作者:
vegewell
時間:
2012-11-2 12:53
回復
1#
frty5566
從 藍芽serial port 輸入的訊號, 又能輸出到Serial Monitor在螢幕看到,
你必須使用 new SoftwareSerial library,
順接使用 Amarino/MeetAndroid library,
請自行搜尋
作者:
frty5566
時間:
2012-11-5 20:21
請問一下 Serial Monitor裡下方要怎麼設定
頻率和 另外一個
RX TX 從手機來的數據 能不能直接運用在max/msp 5.0的程式裡
作者:
vegewell
時間:
2012-11-5 22:02
回復
3#
frty5566
>>>>請問一下 Serial Monitor裡下方要怎麼設定
頻率和 另外一個?
這裡有樣本:
http://my.safaribooksonline.com/book/hobbies/9781449399368/serial-communications/receiving_serial_data_from_two_devic
特別從文章<4.15.3.1. Receiving data from multiple NewSoftSerial ports>以下很類此
>>>>RX TX 從手機來的數據 能不能直接運用在max/msp 5.0的程式裡
可以,請看:
Arduino + MAX/MSP
http://www.arduino.cc/playground/interfacing/MaxMSP
作者:
coopermaa
時間:
2013-1-2 23:39
這個你可能會有興趣:
Amarino with SoftwareSerial
歡迎光臨 Robofun 機器人論壇 (https://robofun.net/forum/)
Powered by Discuz! X3.2