-Functions ที่ใช้กับ Serial กับBoad arduino ของ UNO R3 RX TX จะเป็น pin 0 และ 1 ตามลำดับ
-มีExamplesด้วยในเว็ปนี้
http://www.arduino.cc/en/Reference/SoftwareSerial
-เว็ปนี้จะมาโค้ดแหละ SoftwareSerial Library ให้ศึกษา
/*
Software serial multple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)
Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example
This example code is in the public domain.
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("Hello, world?");
}
void loop() // run over and over
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
https://www.youtube.com/watch?v=KYWCkdrCUKg
-คริป serial communicataion การส่งสัญญาณไปกับระหว่างคอมกัย arduino
http://www.ayarafun.com/2015/05/serial-and-variable-funbasic-io/
-เริ่มใช้งานพื้นฐานของ พอร์ตการสื่อสารกันครับ สำหรับการสื่อสารภายนอก ใน Arduino จะใช้พอร์ตที่เรียกว่า Serial หรือ ภาษาไทยเรียกพอร์ตอนุกรม Serial เป็นการสื่อสาร ระหว่างคอมพิวเตอร์ กับ อุปกรณ์ สามารถแสดงค่าตัวแปร หรือ แสดงตัวอักษรข้อความได้ ผ่าน Serial Monitor ซึ่งปกติ เราจะใช้ในการแสดงผล เพื่อ Debug โปรแกรม ว่าทำงานถูกไหม หรือ อาจจะใช้เพื่อรับคำสั่งก็ยังครับ
http://www.arduino.cc/en/Main/ArduinoBoardNano
-arduino nano ข้อมูล overview,schematic และ design ,spec
https://www.youtube.com/watch?v=vslACsQTgno
-คริป atlas scientific E.C. Ezo stamp
-อธิบายการต่อ การใช้งานต่างๆ
-รายละเอียดElectrical Conductivity Kit คือ ชุด Sensor ในการตรวจวัดค่า Conductivity ในน้ำ ซึ่งจะทำให้เรารู้ส่วนประกอบของสสารที่วัดว่ามีปริมาณของแร่ธาตุต่าง ๆ จำนวนเท่าไหร่ โดย Sensor จะตรวจวัดค่าแล้วมีตัวประมวลผล ผู้ใช้งานสามารถเก็บค่าที่วัดได้ไปประมวลผล โดย Interface กับโมดูลผ่านทาง Serial Port (UART) เพียงส่งคำสั่งไปที่ โมดูล ก็จะได้ Data ตามต้องการ
http://www.thaieasyelec.com/products/sensors/ph-d-o-orp/ph-sensor-kit-detail.html
-รายละเอียด pH Sensor Kit เป็นชุด Sensor ตรวจจับความเป็นกรดด่าง พร้อมโมดูล Controller ที่ทำหน้าที่ตรวจจับสัญญาณ Analog ที่วัดได้จาก Sensor แล้วประมวลผลส่งข้อมูลให้กับผู้ใช้งานทาง Serial Port (UART) ผู้ใช้เพียงส่งคำสั่งไปที่ โมดูล Controller เพื่อ Get Data ตามต้องการ
-โค้ดการเขียนการสือสารระหว่าง คอมกับบอร์ด หรือ serial port
void setup() {
pinMode(13,OUTPUT);
digitalWrite(13,LOW);
Serial.begin(9600);
}
bool x = LOW;
void loop() {
if(Serial.available()>0){
int latter = Serial.read();
if(latter == '1'){
x = !x;
digitalWrite(13,x);
if(x ==LOW)
Serial.println("OFF");
else Serial.println("ON");
delay(1000);
}
}
}



ไม่มีความคิดเห็น:
แสดงความคิดเห็น