ความรู้แน่น ฟรีสำหรับชุมชน ArduinoAll ที่นี่เท่านั้น

ฟรีและดีที่สุด คอร์สอบรม Arduino + NodeMCU
ทำเพื่อแบ่งปัน ห้ามนำไปจำหน่าย หรือเก็บเงินค่าเรียน
  !!!


  


AllNewStep รับประกันคุณภาพทุกชิ้น วันจันทร์-ศุกร์แจ้งชำระสินค้าก่อน 14.00 จัดส่งทันทีวันนี้ค่ะ

กรุงเทพ /ภาคกลาง ได้พรุ่งนี้


*** สินค้าทุกชิ้น ถ้าสามารถทำรายการสั่งซื้อได้ แสดงว่ามีครบทุกรายการค่ะ *** 

พิมพ์ค้นหาบทความ หัวข้อกระทู้ และสินค้าในเว็บ AllNewStep ได้ที่นี่
QUOTE 

ใช้งาน Arduino Data log ger Shield ดัดแปลงใช้กับ Arduino mega แต่คอมไฟล์ไม่ผ่าน

wattasin

ทำตามลิงค์ www.youtube.com/watch?v=jVPf_JFUQdo ทุกอย่างครับ

โหลดไลบารีมาแล้วก็อบไปวางที่file adrduino /Library

จากนั้นก็ก๊อบโค๊ดที่ใช้งาน Arduino Data log ger Shield ดัดแปลงใช้กับ Arduino mega

แต่คอมไพล์ไม่ผ่าน 

มันเตือนว่า

 

Arduino: 1.5.8 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

 

sketch_jun03a.ino: In function 'void setup()':

sketch_jun03a.ino:28:31: error: no matching function for call to 'SDClass::begin(int, int, int, int)'

sketch_jun03a.ino:28:31: note: candidate is:

In file included from sketch_jun03a.ino:5:0:

C:\Users\Administrator\Documents\Arduino\libraries\SD\src/SD.h:68:11: note: boolean SDClass::begin(uint8_t)

   boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);

           ^

C:\Users\Administrator\Documents\Arduino\libraries\SD\src/SD.h:68:11: note:   candidate expects 1 argument, 4 provided

Error compiling.

 

  This report would have more information with

  "Show verbose output during compilation"

  enabled in File > Preferences.

 

มีวิธีแก้ไขได้อย่างไรบ้างครับ

QUOTE 
ความคิดเห็นที่ #1
เจ้าของร้าน

ลองเช็คไลบารี sd card ครับ ตามตัวอย่างเป็นของ Arduino IDE เวอร์ชัน 1.0.5 ครับ เวอร์ชัน 1.5.8 อาจมีการเปลี่ยนแปลง

QUOTE 
ความคิดเห็นที่ #2
wattasin

ผมลองโหลด Arduino IDE เวอร์ชัน 1.0.5 มาลองใช้ดุแล้วครับ แต่ก็ยังเป็นเหมือนเดิม

เตือนว่า

sketch_jun03a.ino: In function 'void setup()':

sketch_jun03a:28: error: no matching function for call to 'SDClass::begin(int, int, int, int)'

 

C:\Program Files (x86)\Arduino\libraries\SD/SD.h:69: note: candidates are: boolean SDClass::begin(uint8_t)

QUOTE 
ความคิดเห็นที่ #3
เจ้าของร้าน

ยังคอมไพล์ไม่ผ่าน ติดไลบารี sd card ลองหาไลบารี sd card ตัวอื่นมาลองครับ

QUOTE 
ความคิดเห็นที่ #4
SD การ์ดบันทึกไม่ได้

The circuit:

 * SD card attached to SPI bus as follows:

** Mega:  MOSI - pin 51, MISO - pin 50, CLK - pin 52, CS - pin 4 (CS pin can be changed)

  and pin #52 (SS) must be an output

อยากทราบว่า MOSI - pin 51, MISO - pin 50, CLK - pin 52, ไปใส่ตรงไหนของโค๊ตครับ??

#include <SPI.h>

#include <SD.h>

 

// On the Ethernet Shield, CS is pin 4. Note that even if it's not

// used as the CS pin, the hardware CS pin (10 on most Arduino boards,

// 53 on the Mega) must be left as an output or the SD library

// functions will not work.

const int chipSelect = 4;

 

File dataFile;

 

void setup()

{

 // Open serial communications and wait for port to open:

  Serial.begin(9600);

   while (!Serial) {

    ; // wait for serial port to connect. Needed for Leonardo only

  }

 

 

  Serial.print("Initializing SD card...");

  // make sure that the default chip select pin is set to

  // output, even if you don't use it:

  pinMode(SS, OUTPUT);

  

  // see if the card is present and can be initialized:

  if (!SD.begin(chipSelect)) {

    Serial.println("Card failed, or not present");

    // don't do anything more:

    while (1) ;

  }

  Serial.println("card initialized.");

  

  // Open up the file we're going to log to!

  dataFile = SD.open("datalog.txt", FILE_WRITE);

  if (! dataFile) {

    Serial.println("error opening datalog.txt");

    // Wait forever since we cant write data

    while (1) ;

  }

}

 

void loop()

{

  // make a string for assembling the data to log:

  String dataString = "";

 

  // read three sensors and append to the string:

  for (int analogPin = 0; analogPin < 3; analogPin++) {

    int sensor = analogRead(analogPin);

    dataString += String(sensor);

    if (analogPin < 2) {

      dataString += ","; 

    }

  }

 

  dataFile.println(dataString);

 

  // print to the serial port too:

  Serial.println(dataString);

  

  // The following line will 'save' the file to the SD card after every

  // line of data - this will use more power and slow down how much data

  // you can read but it's safer! 

  // If you want to speed up the system, remove the call to flush() and it

  // will save the file only every 512 bytes - every time a sector on the 

  // SD card is filled with data.

  dataFile.flush();

  

  // Take 1 measurement every 500 milliseconds

  delay(500);

}

 

 

 

 

 

 

 

 

 

 

QUOTE 
ความคิดเห็นที่ #5
เจ้าของร้าน

ตามนี้ครับ 

http://www.arduinoall.com/b/16

QUOTE 
ความคิดเห็นที่ #6
wattasin

เปลี่ยนเป็น50,51,52,53แล้วยังerrorคับ

QUOTE 
ความคิดเห็นที่ #7
เจ้าของร้าน

คอมไพล์ผ่านมั้ยครับ ผมลองโคดตาม #4 คอมไพล์ผ่าน

ถ้าคอมไพล์ไม่ผ่าน ลองเช็คไลบารี/เช็คว่าเลือกบอร์ดถูกแล้ว อีกครั้งครับ

QUOTE 
ความคิดเห็นที่ #8
wattasin

ผมเปลี่ยนconst int chipSelect = 53;

คอมไพล์ผ่านคับ แต่SD Card ไม่บันทึก เป็นไฟล์ text.Text 

ผมต้องเปลี่ยนโค๊ตตรงไหนคับ

QUOTE 
ความคิดเห็นที่ #9
เจ้าของร้าน

ต่อตามนี้ http://www.arduinoall.com/b/16

Shield ขาจะฟิกตำแหน่งไว้แล้วนะครับ

QUOTE 
ความคิดเห็นที่ #10
wattasin

คอมไพล์ผ่านแล้วครับ พอเปิดไฟล์ Text มา ดันไม่มีข้อมูลคับ

จะแก้ไขอย่างไรดีครับ

แสดงความคิดเห็นที่ 1-10 จากทั้งหมด 12 ความคิดเห็น
ขาย ARDUINO
คุณภาพ อันดับ 1

ได้รับรางวัลร้านยอดเยี่ยม
ตั้งแต่ปี 2558
ขาย Arduino
วีดีโอสอน Arduino

สอน esp8266

สอน Arduino IoT
สอน Arduino แบบเร็ว

สอน NodeMCU

อุปกรณ์ Arduino

MEMBER ZONE

พูดคุย-สอบถาม