Galileoのスケッチについて

Arduino に関するご質問などはこちらへ。

Galileoのスケッチについて

投稿記事by Mari » 2014年3月27日(木) 14:22

先日IntelのGalileoを購入したのですが、GalileoのIDEでArduinoで使ってたスケッチをコピペしてコンパイル検証するとエラーがでてしまいます。。。
同じスケッチで問題ないと思っていたのですが。。。Waveシールドのスケッチコピペで以下のエラーがでました。原因のわかるかたいらっしゃいましたら是非ご教授いただきたく。。。
ArduinoのIDE(v1.0.5)では問題なく動いていました。SDカード内の曲を全曲ループさせるプログラムです。

[エラー]
Arduino: 1.5.3 (Windows NT (unknown)), Board: "Intel® Galileo"
In file included from C:\arduino-1.5.3\libraries\AF_Wave/sd_raw.h:15:0,
from C:\arduino-1.5.3\libraries\AF_Wave/AF_Wave.h:5,
from PlayAllLoop.pde:1:
C:\arduino-1.5.3\libraries\AF_Wave/sd_raw_config.h:88:6: error: #error "no sd/mmc pin mapping available!"
PlayAllLoop.pde:2:26: fatal error: avr/pgmspace.h: No such file or directory
compilation terminated.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

[プログラム]
#include <AF_Wave.h>
#include <avr/pgmspace.h>
#include "util.h"
#include "wave.h"

AF_Wave card;
File f;
Wavefile wave; // only one!

#define redled 9

uint16_t samplerate;

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Wave test!");

pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(redled, OUTPUT);

if (!card.init_card()) {
putstring_nl("Card init. failed!"); return;
}
if (!card.open_partition()) {
putstring_nl("No partition!"); return;
}
if (!card.open_filesys()) {
putstring_nl("Couldn't open filesys"); return;
}

if (!card.open_rootdir()) {
putstring_nl("Couldn't open dir"); return;
}

putstring_nl("Files found:");
ls();
}

void ls() {
char name[13];
int ret;

card.reset_dir();
putstring_nl("Files found:");
while (1) {
ret = card.get_next_name_in_dir(name);
if (!ret) {
card.reset_dir();
return;
}
Serial.println(name);
}
}

uint8_t tracknum = 0;

void loop() {
uint8_t i, r;
char c, name[15];


card.reset_dir();
// scroll through the files in the directory
for (i=0; i<tracknum+1; i++) {
r = card.get_next_name_in_dir(name);
if (!r) {
// ran out of tracks! start over
tracknum = 0;
return;
}
}
putstring("\n\rPlaying "); Serial.print(name);
// reset the directory so we can find the file
card.reset_dir();
playcomplete(name);
tracknum++;
}

void playcomplete(char *name) {
uint16_t potval;
uint32_t newsamplerate;

playfile(name);
samplerate = wave.dwSamplesPerSec;
while (wave.isplaying) {
// you can do stuff here!
delay(500);
}
card.close_file(f);
}

void playfile(char *name) {
f = card.open_file(name);
if (!f) {
putstring_nl(" Couldn't open file"); return;
}
if (!wave.create(f)) {
putstring_nl(" Not a valid WAV"); return;
}
// ok time to play!
wave.play();
}
Mari
 
記事: 3
登録日時: 2014年3月27日(木) 13:40

Re: Galileoのスケッチについて

投稿記事by yamaguch » 2014年3月27日(木) 21:00

こんにちは、

C:\arduino-1.5.3\libraries\AF_Wave/sd_raw_config.h:88:6: error: #error "no sd/mmc pin mapping available!"
PlayAllLoop.pde:2:26: fatal error: avr/pgmspace.h: No such file or directory
compilation terminated.


AVR マイコン用の pgmspace.h というファイルがないですよというのがエラーメッセージです。
AVR は Atmel 社のマイコンで pgmspace.h は AVR 固有のプログラムメモリを使うためのヘッダファイルです。
Galileo は Intel でしたっけ ;)

山口
yamaguch
 
記事: 482
登録日時: 2010年7月06日(火) 17:37

Re: Galileoのスケッチについて

投稿記事by Mari » 2014年3月28日(金) 10:45

山口さん

ご返信ありがとうございます :)

GalileoはIntel製になります。
と、いうことはAVRを使用していないGalileoではpgmspace.hの部分を自力でプログラムする必要があるということですかね。。。?
他のシールドも全滅だったのも同じ原因かもしれません、スケッチもすべて流用できると考えたのが愚かでした。。。もう少しいじってみます。
Mari
 
記事: 3
登録日時: 2014年3月27日(木) 13:40


Return to Arduino 質問箱

cron