极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

12
返回列表 发新帖
楼主: lonewolf

ATMega8最小系统和蜂鸣器做音乐盒

[复制链接]
 楼主| 发表于 2012-8-3 16:49:11 | 显示全部楼层
羽衣甘蓝 发表于 2012-8-3 13:19
我下了库函数,用的就是这段代码,但是编译的时候会出现这样的错误:sketch_aug03a:37: error: invalid con ...

刚试了一下,与用的IDE版本有关。在0023里面没有问题,1.0里面就出错。

还有,代码以文本放到帖子里面,数组的下标不显示了。我重新编辑了帖子,你重新复制一下代码。
回复 支持 反对

使用道具 举报

发表于 2012-8-3 16:59:25 | 显示全部楼层
lonewolf 发表于 2012-8-3 16:49
刚试了一下,与用的IDE版本有关。在0023里面没有问题,1.0里面就出错。

还有,代码以文本放到帖子里面 ...

老的库文件好像不能在1.0直接使用,要修改.cpp和.h文件的头部某个内容……弘毅大哥有一篇文章讲过……你可以找一下!
回复 支持 反对

使用道具 举报

发表于 2012-8-3 17:02:24 | 显示全部楼层
可以在周围下几个led,反正你还有好多端口……可以弄成渐变的,哈哈,还是挺有feel的!就是怕走线时又多很多麻烦……
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-8-3 19:46:11 | 显示全部楼层
arduino-tinker 发表于 2012-8-3 17:02
可以在周围下几个led,反正你还有好多端口……可以弄成渐变的,哈哈,还是挺有feel的!就是怕走线时又多很多 ...

本来也想这样弄,后来觉得麻烦。
回复 支持 反对

使用道具 举报

发表于 2012-8-4 10:49:39 | 显示全部楼层
void loop() {
  for (int i = 0; i < songLength; i++) {
    playNote(notes, beats); // make sound
  }
}
这里好像也有问题,音乐放完一遍后就不重复了,把songLength改成25就可以了,这是为啥呢?
回复 支持 反对

使用道具 举报

发表于 2012-10-12 21:49:15 | 显示全部楼层
atmega8使用3v电源够?
· 工作电压   
– 2.7 - 5.5V (ATmega8L)
– 4.5 - 5.5V (ATmega8)
回复 支持 反对

使用道具 举报

发表于 2012-11-23 18:03:52 | 显示全部楼层
我也想问,楼主用3v把atmega8跑在16mhz频率?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2012-11-24 19:58:29 | 显示全部楼层
zhujunsan 发表于 2012-11-23 18:03
我也想问,楼主用3v把atmega8跑在16mhz频率?

事实证明是可以。
如果手头有ATmega8L的话,还是用8L吧。
回复 支持 反对

使用道具 举报

发表于 2014-7-8 22:27:45 | 显示全部楼层
编译出错什么问题???
D:\arduino-1.0.1\libraries\Tone\Tone.cpp: In member function 'void Tone::begin(uint8_t)':
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:132: error: 'bitWrite' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:134: error: 'digitalPinToPort' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:134: error: 'portOutputRegister' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:135: error: 'digitalPinToBitMask' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp: In member function 'void Tone::play(uint16_t, uint32_t)':
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:198: error: 'OUTPUT' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:198: error: 'pinMode' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:301: error: 'bitWrite' was not declared in this scope
D:\arduino-1.0.1\libraries\Tone\Tone.cpp: In member function 'void Tone::stop()':
D:\arduino-1.0.1\libraries\Tone\Tone.cpp:361: error: 'digitalWrite' was not declared in this scope
回复 支持 反对

使用道具 举报

发表于 2014-9-12 15:34:03 | 显示全部楼层
楼主能不能把库文件发给我,下载不了了  谢谢 [email protected]
回复 支持 反对

使用道具 举报

发表于 2014-10-22 20:15:59 | 显示全部楼层
不晓得楼主是啥网,反正我是打不开你给的那个库文件网址
回复 支持 反对

使用道具 举报

发表于 2014-12-24 00:24:04 | 显示全部楼层
支持一下!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-17 00:39 , Processed in 0.043640 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表