Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > กระทู้สำหรับภาษาต่าง ๆ > C - โปรแกรม โชว์ค่า ขึ้น LCD มันได้ผลที่ต้องการแต่มีบัคภาษาแปลกๆติดมาอีก1ตัว พี่ๆโปรแกรมเมอร์ช่วยชี้แนะทีครับ



C - โปรแกรม โชว์ค่า ขึ้น LCD มันได้ผลที่ต้องการแต่มีบัคภาษาแปลกๆติดมาอีก1ตัว พี่ๆโปรแกรมเมอร์ช่วยชี้แนะทีครับ

 
Topic : 101417

Guest



ภาพ มีบัคติดมา1ตัว

#include <LiquidCrystal.h> ///คำสั่ง #include แล้วตามด้วยไฟล์ที่อยู่ใน Folder ชื่อ Libraries #include <Wire.h> LiquidCrystal lcd(8, 9, 4, 5, 6, 7); String inputstring = ""; //a string to hold incoming data from the PC String sensorstring = ""; //a string to hold the data from the Atlas Scientific product boolean input_stringcomplete = false; //have we received all the data from the PC boolean sensor_stringcomplete = false; //have we received all the data from the Atlas Scientific //product /////////////////////////////////////////////////// void setup(){ lcd.begin(16, 2); // start the library lcd.setCursor(0,0); //set up the hardware Serial.begin(38400); //set baud rate for the hardware serial port_0 to 38400 Serial1.begin(38400); //set baud rate for software serial port_3 to 38400 inputstring.reserve(5); //set aside some bytes for receiving data from the PC sensorstring.reserve(30); //set aside some bytes for receiving data from Atlas Scientific } //product ///////////////////////////////////////////////// void serialEvent() { //if the hardware serial port_0 receives char inchar = (char)Serial.read(); //a char inputstring += inchar; //get the char we just received if(inchar == '\r') {input_stringcomplete = true;} //add it to the inputString } //if the incoming character is a <CR>, //set the flag ///////////////////////////////////////////////// void serialEvent1( ){ //if the hardware serial port_3 receives char inchar = (char)Serial1.read(); //a char sensorstring += inchar; //get the char we just received if(inchar == '\r') {sensor_stringcomplete = true;} //add it to the inputString } //if the incoming character is a <CR>, //set the flag ////////////////////////////////////////////// void loop(){ //here we go... if (input_stringcomplete){ //if a string from the PC has been received in its entierty Serial1.print(inputstring); inputstring = ""; //clear the string: input_stringcomplete = false; //reset the flag used to tell if we have received a completed } //string from the PC if (sensor_stringcomplete){ //if a string from the Atlas Scientific product has been Serial.println(sensorstring); lcd.clear(); lcd.print(sensorstring); <<<<< เนี่ยอ้ะครับ[b][/b] sensorstring = ""; //send that string to to the PC's serial monitor sensor_stringcomplete = false; //clear the string: } //reset the flag used to tell if we have received a } //completed string from the Atlas Scientific product




Tag : C


Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-10-07 21:33:00 By : จักรกฤษณ์ View : 892 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Bug ว่าอะไรครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-10-08 09:50:04 By : mr.win
 


   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : C - โปรแกรม โชว์ค่า ขึ้น LCD มันได้ผลที่ต้องการแต่มีบัคภาษาแปลกๆติดมาอีก1ตัว พี่ๆโปรแกรมเมอร์ช่วยชี้แนะทีครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่