查看: 4384|回复: 17
|
自制Digispark: 最小USB Arduino
[复制链接]
|
|
发表于 21-5-2013 10:24 PM
|
显示全部楼层
那个USB接口是直接接USB吗?是普通I/O吗? 里面有内置USB 接收器?还是用软驱?看起来很简单也挺方便。。
|
|
|
|
|
|
|
|

楼主 |
发表于 21-5-2013 10:41 PM
|
显示全部楼层
sougisyou 发表于 21-5-2013 10:24 PM 
那个USB接口是直接接USB吗?是普通I/O吗? 里面有内置USB 接收器?还是用软驱?看起来很简单也挺方便。。
...
那是真真旳USB接口,是软驱USB。
如果上载了以下代码,就变成了USB键盘。- #include "DigiKeyboard.h"
- void setup() {
- // don't need to set anything up to use DigiKeyboard
- }
- void loop() {
- // this is generally not necessary but with some older systems it seems to
- // prevent missing the first character after a delay:
- DigiKeyboard.sendKeyStroke(0);
-
- // Type out this string letter by letter on the computer (assumes US-style
- // keyboard)
- DigiKeyboard.println("Hello Digispark!");
-
- // It's better to use DigiKeyboard.delay() over the regular Arduino delay()
- // if doing keyboard stuff because it keeps talking to the computer to make
- // sure the computer knows the keyboard is alive and connected
- DigiKeyboard.delay(5000);
- }
复制代码 上面代码模拟键盘形成USB HID(USB human interface device),每五秒输入Hello Digispark!字串至电脑。使用此方式可以很快设计data logger设备
|
|
|
|
|
|
|
|

楼主 |
发表于 21-5-2013 10:48 PM
|
显示全部楼层
各位不防设计一个来玩玩,反正一个ATTINY85微控制器才售价RM3.87 |
|
|
|
|
|
|
|
发表于 21-5-2013 10:54 PM
|
显示全部楼层
西门庆33 发表于 21-5-2013 10:41 PM 
那是真真旳USB接口,是软驱USB。
如果上载了以下代码,就变成了USB键盘。上面代码模拟键盘形成USB HID( ...
很有趣,我一直以为USB接口需要很严格没有专门的晶片是做不到。不知道你有关于如何写软驱USB的资料吗?我想实验如何做软驱USB。。
|
|
|
|
|
|
|
|
发表于 21-5-2013 11:09 PM
|
显示全部楼层
西门庆33 发表于 21-5-2013 10:48 PM 
各位不防设计一个来玩玩,反正一个ATTINY85微控制器才售价RM3.87
有机会也想试试看,尤其是对那个软驱USB非常感兴趣。 ,我对于高级语言有一定的困难。。 手上还有ARM7,Cortex M3还没学好。 因为我坚强用assembly写 ARM 。还搞不好呢。。只要任何AVR都可以做arduino吗?还是有一些可以?我之前好像有买一些AVR MCU没用到,忘了是什么型号。
|
|
|
|
|
|
|
|

楼主 |
发表于 21-5-2013 11:18 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 21-5-2013 11:25 PM
|
显示全部楼层
sougisyou 发表于 21-5-2013 11:09 PM 
有机会也想试试看,尤其是对那个软驱USB非常感兴趣。 ,我对于高级语言有一定的困难。。 手上还有AR ...
不是所有AVR可以做Arduino,从ATTINY45,ATTINY85,ATTINY2313至ATMEGA都可以做Arduino。具体可参考Arduino products
|
|
|
|
|
|
|
|

楼主 |
发表于 21-5-2013 11:30 PM
|
显示全部楼层
sougisyou 发表于 21-5-2013 11:09 PM 
有机会也想试试看,尤其是对那个软驱USB非常感兴趣。 ,我对于高级语言有一定的困难。。 手上还有AR ...
为了快速完成设计,也是时候多学一种高级语言吧?
|
|
|
|
|
|
|
|
发表于 22-5-2013 06:22 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 22-5-2013 06:26 PM
|
显示全部楼层
西门庆33 发表于 21-5-2013 10:48 PM 
各位不防设计一个来玩玩,反正一个ATTINY85微控制器才售价RM3.87
西门庆33你有卖吗?
如果想学ATTiny,从哪里开始?
下载器是如何的。
|
|
|
|
|
|
|
|

楼主 |
发表于 22-5-2013 08:44 PM
|
显示全部楼层
Chrous 发表于 22-5-2013 06:26 PM 
西门庆33你有卖吗?
如果想学ATTiny,从哪里开始?
下载器是如何的。
这要看你熟悉那一种语言。其中比较多人使用的语言有
以上Compiler最终目的是把代码编辑成hex文件,然後用烧录器(Programmer)将hex文件烧录至微控制器。无论如何,你必须拥有一个ISP Programmer
ISP Programmer有很多种,其中
- 便宜的有AVR USBASP Programmer(RM 39.00)
- 西门庆用的是AVRISP MKII,带有AVR Studio软件(RM 132.03)
- Arduino也可以当成Programmer
当然初学者可以学习Arduino编程,用 Arduino IDE编程,然後产生hex文件,最后把hex文件Burn去微控制器。
Digispark是最容易使用的了,第一次把Bootloader Burn去 ATTINY85,以後再也不需要使用烧录器了。
更新:22/05/13 11.11pm
西门庆没有卖Digispark, 去Element14买一个ATTINY85,跟着上面步骤自己动手做 本帖最后由 西门庆33 于 22-5-2013 11:12 PM 编辑
|
|
|
|
|
|
|
|
发表于 22-5-2013 10:18 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 22-5-2013 11:30 PM
|
显示全部楼层
sougisyou 发表于 22-5-2013 10:18 PM 
还是看不懂啊。。 不过还是谢谢你。。
看得懂V-USB软驱吗?其中usbdrv文件夹里有一个文件(usbdrvasm.S)使用asm的
|
|
|
|
|
|
|
|

楼主 |
发表于 23-5-2013 11:20 AM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 28-5-2013 12:29 AM
|
显示全部楼层
根据Digispark的Infrared例子,使用了Sharp的GP1UX511QS photo diode来测试了红外。按遥空器的任何键都会开灯,一秒后关灯。- int irPin=2;
-
- void setup()
- {
- pinMode(irPin,INPUT);
- pinMode(0,OUTPUT);
- //Serial.begin(9600);
- digitalWrite(0,HIGH);
- //Serial.println("You pressed a button");
- delay(1000);
- digitalWrite(0,LOW);
- }
-
- void loop()
- {
-
- if(pulseIn(irPin,LOW))
- {
- //button pressed
- delay(100);
- digitalWrite(0,HIGH);
- //Serial.println("You pressed a button");
- delay(1000);
- digitalWrite(0,LOW);
- }
-
- }
复制代码
接下来是对红外解码,按不同的键控制不同的事件。也可以用来遥空电脑,用来点唱karaoke。
不妨实说。以上已经测试完毕,但也浪费了许多时间。有空放出来让大家研究。
|
|
|
|
|
|
|
|

楼主 |
发表于 30-5-2013 09:40 PM
|
显示全部楼层
炫耀一下
我在instructables发了这个Digispark文章,昨天收到三封email
这是instructables的第一封email
Congratulations, your Step by Step Instructable "Digispark DIY: The smallest USB Arduino" was just featured by one of our editors!
Look for it in the Technology category.
Being featured means we think you are awesome. Keep up the great work!
这是第二封email
Your Step by Step Instructable "Digispark DIY: The smallest USB Arduino" just became popular on Instructables!
Being popular means that tons of people are checking out your Step by Step Instructable and telling us they really like it. Keep up the great work!
第三封email给了三个月Pro会员
"Digispark DIY: The smallest USB Arduino" has been featured to the Instructables homepage! Being featured by our editors means your Instructable stands out and represents one of the best we have.
Projects like yours make Instructables a great place, and we really appreciate your time and effort. As a thank you, we'd like to give you a 3 Month Pro Membership to Instructables. You can use this yourself, or pass it on to anyone else you want by just giving them the gift code and the URL to use it.
|
|
|
|
|
|
|
|

楼主 |
发表于 2-6-2013 11:52 AM
|
显示全部楼层
哈哈!Digispark的作者发了一封电子邮件给我,他说很欣赏我发布关于Digispark的文章。
真真的用意是劝告我必须注明他们的版权。其实这也是我的过错,我得遵守他们版权。 |
|
|
|
|
|
|
| |
本周最热论坛帖子
|