今天给Huluduino加了个USB(不好意思,打个广告,60块出售),芯片是PL2303,正好cb有驱动,于是看看能不能烧写
以下是Huluduino USB大图:
本次使用的是Cubietruck(cb3)
首先呢,先在我的Mac上把Huluduino烧成标准的Blink(1秒亮灭)
然后呢,再拔掉Huluduino,把程序改成这样:- /*
- Blink
- Turns on an LED on for one second, then off for one second, repeatedly.
-
- This example code is in the public domain.
- */
-
- // Pin 13 has an LED connected on most Arduino boards.
- // give it a name:
- int led = 13;
- // the setup routine runs once when you press reset:
- void setup() {
- // initialize the digital pin as an output.
- pinMode(led, OUTPUT);
- }
- // the loop routine runs over and over again forever:
- void loop() {
- digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(2000); // wait for 2 second
- digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
- delay(2000); // wait for 2 second
- }
复制代码 2秒的,然后在Arduino IDE的偏好设置(菜单栏Arduino -> 偏好设置)里面把“输出时显示详细信息:编译”打勾,然后点确定,这样就会显示出hex文件的地址了,再点那个打勾的标志(校验,verify),或者点烧写也可以,不过记得要拔掉Arduino(Huluduino),否则会烧到Arduino里面去,而我们只想要hex文件在cb上烧写。
这是修改后的Blink,然后点击左上角的勾,蓝色的是hex文件的地址
接下来呢,就是复制文件到cb上然后烧写了- TlldeMacBook-Pro:findcb tonylianlong$ sftp root@192.168.1.105
- root@192.168.1.105's password:
- Permission denied, please try again.
- root@192.168.1.105's password:
- Connected to 192.168.1.105.
- sftp> put /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000gn/T/build6629735842786211009.tmp/Blink.cpp.hex /
- Uploading /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000gn/T/build6629735842786211009.tmp/Blink.cpp.hex to /Blink.cpp.hex
- /var/folders/wy/nnl04xcj5sv2wx96xg88hg_h0000g 100% 3078 3.0KB/s 00:00
- sftp> exit
- TlldeMacBook-Pro:findcb tonylianlong$ ssh 192.168.1.105 -l root
- root@192.168.1.105's password:
- llLinux cubieboard 3.4.61v1.2+ #15 SMP PREEMPT Sat Oct 19 23:41:01 CST 2013 armv7l
- Welcome to CbOS 1.0 - a system for Cubieboard
- * Documention: http://www.tonylianlong.com
- s ==================================================
- Now is:Sat Nov 2 17:57:27 CST 2013
- Lastboot:Thu Jan 1 08:00:31 CST 1970
- eth0 IP:192.168.1.105
- disk used:1.4G free:431M %:76%
- memory used:159M free:651M
- ==================================================
- root@cubieboard:~# ls
- CHANGELOG README source_code tools utilities
- root@cubieboard:~# cd /
- root@cubieboard:/# ls
- bin boot etc lib mnt proc run sys usr
- Blink.cpp.hex dev home lost+found opt root sbin tmp var
复制代码 我用sftp上传了,他现在在/目录- root@cubieboard:~/arduino_shao# apt-get install avrdude -y
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- The following extra packages will be installed:
- libelf1 libftdi1
- Suggested packages:
- avrdude-doc
- The following NEW packages will be installed:
- avrdude libelf1 libftdi1
- 0 upgraded, 3 newly installed, 0 to remove and 194 not upgraded.
- Need to get 322 kB/561 kB of archives.
- After this operation, 1,964 kB of additional disk space will be used.
- Get:1 http://ftp.cn.debian.org/debian/ testing/main libelf1 armhf 0.153-2 [303 kB]
- Get:2 http://ftp.cn.debian.org/debian/ testing/main libftdi1 armhf 0.20-1+b1 [18.4 kB]
- Fetched 322 kB in 1s (321 kB/s)
- Selecting previously unselected package libelf1:armhf.
- (Reading database ... 17127 files and directories currently installed.)
- Unpacking libelf1:armhf (from .../libelf1_0.153-2_armhf.deb) ...
- Selecting previously unselected package libftdi1:armhf.
- Unpacking libftdi1:armhf (from .../libftdi1_0.20-1+b1_armhf.deb) ...
- Selecting previously unselected package avrdude.
- Unpacking avrdude (from .../avrdude_6.0.1-1_armhf.deb) ...
- Setting up libelf1:armhf (0.153-2) ...
- Setting up libftdi1:armhf (0.20-1+b1) ...
- Setting up avrdude (6.0.1-1) ...
- root@cubieboard:~/arduino_shao# avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -C /etc/avrdude.conf -U flash:w:Blink.cpp.hex
- avrdude: AVR device initialized and ready to accept instructions
- Reading | ################################################## | 100% 0.00s
- avrdude: Device signature = 0x1e950f
- avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
- To disable this feature, specify the -D option.
- avrdude: erasing chip
- avrdude: reading input file "Blink.cpp.hex"
- avrdude: input file Blink.cpp.hex auto detected as Intel Hex
- avrdude: writing flash (1084 bytes):
- Writing | ################################################## | 100% 0.17s
- avrdude: 1084 bytes of flash written
- avrdude: verifying flash memory against Blink.cpp.hex:
- avrdude: load data flash data from input file Blink.cpp.hex:
- avrdude: input file Blink.cpp.hex auto detected as Intel Hex
- avrdude: input file Blink.cpp.hex contains 1084 bytes
- avrdude: reading on-chip flash data:
- Reading | ################################################## | 100% 0.14s
- avrdude: verifying ...
- avrdude: 1084 bytes of flash verified
- avrdude: safemode: Fuses OK (H:00, E:00, L:00)
- avrdude done. Thank you.
- root@cubieboard:~/arduino_shao#
复制代码 移动后安装avrdude然后烧写:- apt-get install avrdude -y
- avrdude -p m328p -c arduino -b 115200 -P /dev/ttyUSB0 -C /etc/avrdude.conf -U flash:w:Blink.cpp.hex
复制代码 Huluduino的U是328p,和UNO完全兼容,所以可以直接使用上面代码,直接接uno的话在cb上貌似没有驱动,所以不行。
接下来呢,看看Huluduino,是不是2秒闪一下了?
|