Show Posts
Pages: [1] 2 3 ... 126
1  Products / Arduino Yún / Re: How to reset Yun board on: September 17, 2014, 02:06:53 pm
nano /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.



exit 0

uncomment reset-mcu will make reset arduino/mcu once reset cpu AR9331.
2  Products / Arduino Yún / Re: No space left on the device : Please advise on: September 17, 2014, 02:01:11 pm
cd /
du -sh *
448.0K  bin
0       dev
1.1M    etc
4.8M    lib
16.0K   lost+found
276.0K  mnt
4.0K    overlay
0       proc
26.9M   rom
32.0K   root
816.0K  sbin
0       sys
388.0K  tmp
43.0M   usr
0       var
552.0K  www

cd  usr
du -sh *
3  Products / Arduino Yún / Re: Declare file handle before opening file on: September 17, 2014, 10:30:46 am
Rewrite FileIO  for your application (read  one line at time).

nano /mnt/sda1/

import sys
import linecache
script,filepath,linenumber = sys.argv
retrieved_line = linecache.getline(filepath, int(linenumber))
print retrieved_line
#print retrieved_line.rstrip("\r\n")
#print retrieved_line.rstrip("\n")

chmod 755 /mnt/sda1/

nano /mnt/sda1/test.txt

Testing code:
/mnt/sda1/  /mnt/sda1/test.txt  4

Arduino code:
Process p; // Create a process and call it "p"
  p.begin("/mnt/sda1/"); // Process that launch the "readline" command
  p.addParameter("/mnt/sda1/test.txt"); // Add the  file path as parameter to readline
  p.addParameter(n);; // Run the process and wait for its termination

  // Print command output on the Serial.
  // A process output can be read with the stream methods
  while (p.available() > 0) {
    char c =;   //one char by one from line n
  // Ensure the last bit of data is sent.

Loop throughabove code for whole file.
4  Products / Arduino Yún / Re: Unable to setup Bluetooth on Yun on: September 17, 2014, 09:11:28 am
openwrt-yun  has bluez_5.13 but in 2 packages- bluez-libs, bluez-utils.

opkg update
opkg install kmod-bluetooth bluez-libs bluez-utils

but it would not auto mount with kernel 3.3.8  but 3.8.3.   ( new one is 3.3.8, old one is 3.8.3)

use manually mount it.

echo 050d 065a > /sys/bus/usb/drivers/btusb/new_id

root@Arduino:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 003: ID 0424:2507 Standard Microsystems Corp. hub
Bus 001 Device 004: ID 058f:6366 Alcor Micro Corp. Multi Flash Reader
Bus 001 Device 005: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0

root@Arduino:~# echo 0a5c 21e8> /sys/bus/usb/drivers/btusb/new_id
root@Arduino:~# hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:02:72:33:96:0A  ACL MTU: 1021:8  SCO MTU: 64:1
        RX bytes:489 acl:0 sco:0 events:20 errors:0
        TX bytes:86 acl:0 sco:0 commands:20 errors:0

5  Products / Arduino Yún / Re: How can C program running on YUN linux, can comminucate with Arduino? on: September 16, 2014, 10:47:23 am
6  Products / Arduino Yún / Re: Bridge Speed on: September 16, 2014, 10:45:41 am
Profile bridge speed:

Arduino Yun Bridge example from IDE.

ab - Apache HTTP server benchmarking tool

ab -n 20 -c 1

Concurrency Level:      1
Time taken for tests:   3.425 seconds
Complete requests:      20
Failed requests:        0
Write errors:           0
Non-2xx responses:      20
Total transferred:      2100 bytes
HTML transferred:       0 bytes
Requests per second:    5.84 [#/sec] (mean)
Time per request:       171.275 [ms] (mean)
Time per request:       171.275 [ms] (mean, across all concurrent requests)
Transfer rate:          0.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   164  171   7.9    169     192
Waiting:      153  159   6.2    156     171
Total:        164  171   7.9    169     192

171.275 [ms] (0.17 s) is average speed of bridge speed, and should meet average application's requirement.

7  Products / Arduino Yún / Re: Bridge Speed on: September 16, 2014, 10:30:55 am
That's how most users have solved the problem: disabling ttyATH0 as linux terminal and use it as pure serial. However, this is hard stuff. Since premature optimization is the root of all evil, I suggest you to postpone this phase until the very last minute.

I agree 100%.  Specially count kernel command line flood  boot message into ttyATH0 (at first 2 mins booting time) plus afterwards send all error and warning messages to ttyATH0 which make using ttyATH0 without error detection and correction become useless.  I recall my professor told me more than 3 decades ago "setup serial communication without error detection and correction just like 'left hand hold gun shoot right hand'"
8  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 15, 2014, 08:07:57 am
option fstype        ext3

for application which do a lot of read use ext4,  for a lot of write use ext2.  no go for ext3.

ext4 has speed advantage at reading , ext2 has speed advantage at writing.  select base on which one you are looking after.
9  Products / Arduino Yún / Re: Yun Hangs, tried everything i could find in the forum, still no luck on: September 14, 2014, 09:42:12 pm
Find out which version Yun is running:

=== Release 1.4.2 - September 4th, 2014
=== Release 1.4.1 - August 8th, 2014
=== Release 1.4 - July 15th, 2014
=== Release 1.3 - July 14th, 2014
=== Release 1.2 - July 11th, 2014
=== Release 1.1 - June 23rd, 2014
=== Release 1.0 - April 17th, 2014

root@Arduino:/mnt/sda1# uname -a
Linux Arduino 3.3.8 #1 Fri Jun 20 12:50:18 CEST 2014 mips GNU/Linux
root@Arduino:/mnt/sda1# cat /etc/arduino/openwrt-yun-release
built=Fri Jun 20 07:32:45 CEST 2014

Why ~5 hours difference?
10  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 14, 2014, 08:55:28 pm
GNU Binary Utilities - objdump:
objdump - display information from object files.

opkg update
opkg install objdump
11  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 14, 2014, 08:50:54 pm
GNU utilities:

The utility "nm" lists symbol table of object files.

root@Arduino:/mnt/sda1# nm hello
00400180 r _DYNAMIC
00400a70 t _GLOBAL__sub_D_main
00400a38 t _GLOBAL__sub_I_main
12  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 14, 2014, 08:28:20 pm
The Grep from BusyBox is not complete:

Download latest Grep here(For testing purpose only):

wget -O grep_2.14-1_ar71xx.ipk --no-check-certificate

opkg install grep_2.14-1_ar71xx.ipk
13  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 14, 2014, 08:19:47 pm
GNU utilities:

"file" Utility - Determine File Type:

opkg update
opkg install file

root@Arduino:/mnt/sda1# file hello
hello: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs),
with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70403, not stripped

14  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 14, 2014, 08:01:30 pm
C++ compile:

nano hello.cpp

// 'Hello World!' program
#include <iostream>
int main()
  std::cout << "Hello World!" << std::endl;
  return 0;

g++  hello.cpp -o hello

root@Arduino:/mnt/sda1# ./hello
./hello: can't load library ''

if I recompile it with static link

g++  hello.cpp -o hello  -static

Every thing is working, but obviously that is not I want.

After google ,

opkg update
opkg install libstdcpp

g++  hello.cpp -o hello

root@Arduino:/mnt/sda1# ./hello
Hello World!
15  Products / Arduino Yún / Re: Example of Native GCC for Yun on: September 14, 2014, 12:17:53 am
Compile and install Lua Module(C API)

Install lua_devel:

cd /usr/local/include
wget -O lua_devel.tar.gz --no-check-certificate
tar -xzf lua_devel.tar.gz
rm lua_devel.tar.gz

Download and compile lua-cjson:

cd /mnt/sda1/
tar -xzf lua-cjson-2.1.0.tar.gz
cd /mnt/sda1/lua-cjson-2.1.0

gcc -c -O3 -Wall -pedantic -DNDEBUG  -I/usr/local/include -fpic -o lua_cjson.o lua_cjson.c
gcc -c -O3 -Wall -pedantic -DNDEBUG  -I/usr/local/include -fpic -o strbuf.o strbuf.c
gcc -c -O3 -Wall -pedantic -DNDEBUG  -I/usr/local/include -fpic -o fpconv.o fpconv.c
gcc  -shared -o lua_cjson.o strbuf.o fpconv.o

Install lua-cjson:

cp /usr/lib/lua/

Testing lua-cjson:

cd /mnt/sda1/
nano arduino.lua

-------simple data-------
local tab ={}
tab["arduino"] = ""
--encode json -------
local cjson = require "cjson"
local jsonData = cjson.encode(tab)
-- print result:  {"arduino":""}
--decode json -------
local data = cjson.decode(jsonData)
-- print result:

root@Arduino:/mnt/sda1# chmod 755 arduino.lua
root@Arduino:/mnt/sda1# ./arduino.lua

lua-cjson (C-API)  V.S.  pure lua  json module performance boost 1000% to 2000%!

Pages: [1] 2 3 ... 126