Show Posts
Pages: 1 2 3 [4] 5 6 ... 9
46  Products / Arduino Yún / Re: Node.js and socket.io on the yun on: May 15, 2014, 04:05:55 am
super good! thanks!
47  Products / Arduino Yún / Re: Node.js and socket.io on the yun on: May 09, 2014, 01:07:32 pm
just a feedback:
with the fibasile compiled ws module and then `npm install socket.io` everything seems to work fine
48  Products / Arduino Yún / Change wifi connection (without ssh) on: May 09, 2014, 12:19:12 pm
Hi!
I tried the yun in a different place rather then home, with a different wifi connection.
It was not very clear from the tutorial how to reconfigure the wifi and reset the wifi name and password. I cannot access to the linux machine by ssh (the linux machine not connected in the new wifi) and the access point was not up (I don't know if it is intended to be up if it can not connect to the wifi).
But I could do something from the atmega.. (I love this yun & bridge system, really, super good job)

I share my small sketch, maybe  could be useful to someoneelse!
Please tells me if anyone has some advice or some fixes

Code:

/*
 
  Based on:
    Examples > Bridge > Process
    Running process using Process class by Cristian Maglie
 
    Examples > Bridge > WifiStatus
    WiFi Status by Federico Fissore
 
  This example code is in the public domain.
 
 */

#define NEXT_PAGE "..........................................................................."
#include <Process.h>

void setup() {
  Bridge.begin();
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Hello.");
  printMenu();
}

void loop() {
  if (Serial.available() > 0) {
    int in = Serial.read() -'0';
    switch(in) {
      case 1: runCpuInfo();  break;
      case 2: runCurl();     break;
      case 3: runScan();     break;
      case 4: runLua();      break;
      case 5: runCat();      break;
      case 6: runIfconfig(); break;
      case 7: runWifiup();   break;
      default: Serial.println("Enter a number between 1 and 7");
               break;
    }
  }
  delay(50);
}

void printMenu() {
  Serial.println("\n\n\nNetwork Utility");
  Serial.println("press:");
  Serial.println("1. cpu info");
  Serial.println("2. curl test");
  Serial.println("3. scan networks in range");
  Serial.println("4. print wifi status");
  Serial.println("5. print network config files");
  Serial.println("6. print active networks");
  Serial.println("7. activate access point");
  Serial.println("\n\n\n");
  delay(550);
}

void runLua() {
  Process p;
  p.runShellCommand("/usr/bin/pretty-wifi-info.lua");
  printShellOutput(p);
}

void runCurl() {
  Process p;
  p.begin("curl");
  p.addParameter("http://arduino.cc/asciilogo.txt");
  p.run();
  printShellOutput(p);
}

void runCpuInfo() {
  Process p;
  p.begin("cat");
  p.addParameter("/proc/cpuinfo");
  p.run();
  printShellOutput(p);
}

void runScan() {
  Process p;
  p.begin("iwlist");
  p.addParameter("scan");
  p.run();
  printShellOutput(p);
}

void runIfconfig() {
  Process p;
  p.begin("ifconfig");
  p.run();
  printShellOutput(p);
}

void runCat() {
  Serial.println(NEXT_PAGE);
  Serial.println("/etc/config/wireless");
  Process p;
  p.begin("cat");
  p.addParameter("/etc/config/wireless");
  p.run();
  printShellOutput(p);
 
  Serial.println("/etc/config/network"); 
  p.begin("cat");
  p.addParameter("/etc/config/network");
  p.run();
  printShellOutput(p);
}

void runWifiup() {
  Serial.print('.');
  Process p;
  p.begin("ifup");
  p.addParameter("wan");
  p.run();
  delay(3000);
  Serial.print('.');
  p.begin("wifi");
  p.run();
  delay(3000);
  printShellOutput(p);
}

void printShellOutput(Process &p) {
  while (p.available() > 0) {
    char c = p.read();
    Serial.print(c);
  }
  Serial.println();
  Serial.flush();
  Serial.println(NEXT_PAGE);
  delay(1000);
}

49  Products / Arduino Yún / Re: Check if connected to Internet. on: May 09, 2014, 09:46:27 am
In the examples you'll find also WiFiStatus under Bridge that could help
50  Products / Arduino Yún / Re: Some advice on user feedback on first cold boot of Yun on: May 09, 2014, 09:22:05 am
I know could be totally irrelevant to this post but the new image show if the linux machine is booted with a bright white led
Quote
Linux side ready visual notification: when linux boot completes, the usb led lights up (it's bright white)
http://forum.arduino.cc/index.php?PHPSESSID=0kiej3fr5genejinpfjbd3mh14&topic=235360.0
so with the new image white led == bridge is up
51  Products / Arduino Yún / Re: Node.js and socket.io on the yun on: May 08, 2014, 10:39:08 am
..nodejs is not the problem. the problem is socket.io.
what I have already done: upgrade at the last image, expand with an external sd card for the boot and install node.js via `npm install node`. everything works like a charm.

node.js is working, but try to install socket.io via `npm install socket.io` fails (after more then 10 minutes ssh session crashes and `require('socket.io')` from node console gets some errors like "Error: Cannot find module 'zeparser'", same for `require('ws')`).
but Federico answer explains why smiley

anyway! I was not aware of ws module compiled for websocket in fbasile repository, I'll try it out, thanks!
52  Products / Arduino Yún / Re: Node.js and socket.io on the yun on: May 08, 2014, 09:19:53 am
what can I say? wow!
so.. I'll wait till the end of the next week.
Just three more question:

1) where can I follow the development?
https://github.com/arduino/openwrt-yun/tree/master/package
I don't see the node package (even if I installed it by the `opkg node install` with the new openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade image following the cool tutorial and the arduino sketch that worked like a charm)

2) are there more stable examples of web sockets? maybe with python.. in another post I've seen that websocket&python are used in space brew.
The python websocket lib is the one from Hiroki Ohtani (liris).. but I didn't found examples or tutorial on that. Is there any well-tested and documented websocket lib available?

3) just to not to lie down in the xy problem ( http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem ):
I want a web page be notified without refreshing it when something is happening in the board (i.e. a pushbutton is pressed).
As far as I have understood I have to open a double way communication between the server and the client, if I don't want a continuous polling (like the https://github.com/mat-lo/yun-examples/tree/master/analogInputs where the js setInterval continuously ask the serve status) - and mainly I don't want to not overload the network.
I think that socket.io with node.js could be a nice option.
Is there something obvious that I'm not aware of?

Sorry if this is a dumb question, I'm new to this internet-of-things stuff.
53  Products / Arduino Yún / Node.js and socket.io on the yun on: May 08, 2014, 05:45:07 am
Hi!
I'm wondering if anyone uses socket.io module for node.js, if it has sense or it is too much for the linino
54  International / Software / Re: problema ordinamento file con sd card on: May 06, 2013, 09:45:42 am
ok ho trovato il problema, sembra che mac osx copi i file in parallelo quindi qualcuno viene scritto prima qualcuno viene scritto dopo..

sapete come fare la copia in serie? nel senso: copia il primo,aspetta che finisca, copia il secondo, aspetta che finisca, etc..

?

o con mac osx o con qualche scriptino bash/python va bene lostesso..
55  International / Software / Re: problema ordinamento file con sd card on: May 06, 2013, 08:22:54 am
si sembra proprio così, i file vengono ordinati in base alla data di scrittura grazie ragazzi
56  International / Software / problema ordinamento file con sd card on: May 05, 2013, 03:56:10 pm
ciao a tutti, sto usando la mp3 player shield della sparkfun che usa la micro sd.
non riesco a capire come ordinare i files..
io li vorrei semplicemente.. in ordine.
ho usato questa nomenclatura:

track0001.mp3
track0002.mp3
track0003.mp3
....
track0119.mp3

solo che non capisco proprio perchè, ma se eseguo questa funzione (che è nell'esempio della libreria della scheda)

Code:
void playFile(long fn_index) {
  Serial.println(fn_index);
 
  SdFile file;
  char filename[13];
  sd.chdir("/",true);
  uint16_t count = 1;
  while (file.openNext(sd.vwd(),O_READ))
  {
    file.getFilename(filename);
    if ( isFnMusic(filename) ) {

      if (count == fn_index) {
        Serial.print(F("Index "));
        SerialPrintPaddedNumber(count, 5 );
        Serial.print(F(": "));
        Serial.println(filename);
        Serial.print(F("Playing filename: "));
        Serial.println(filename);
        int8_t result = MP3player.playMP3(filename);
        //check result, see readme for error codes.
        if(result != 0) {
          Serial.print(F("Error code: "));
          Serial.print(result);
          Serial.println(F(" when trying to play track"));
        }
        break;
      }
      count++;
    }
    file.close();
  }
}

legge i file apparentemente a caso..
come posso fare con che ordine vengono letti??
57  International / Hardware / arduino lillypad e accellerometri on: January 03, 2013, 09:55:51 am
ciao a tutti vorrei attaccare questo accellerometro ad un lillypad:
https://www.sparkfun.com/products/10955?
sono riuscito ad usarlo bene con un arduino uno con il pin da 3.3v ma con lillypad (che alimento tramite batteria) non saprei cosa usare per non bruciare il sensore.. qualche idea?
58  International / Hardware / saldature: perchè usare le millefori quando esistono le stripboard? on: November 19, 2012, 04:45:53 am
ciao a tutti..
mi sono sempre considerato un animale nel saldare: dovevo saldare due pin vicini e ho sempre fatto un gran macello, saldature brutte da vedere, incerte, facevano contatti strani, etc

poi un giorno ho scoperto le stripboard. e la vita mi è cambiata. sono semplicissime da usare, si risparmia filo, vengono fuori dei layout belli e facili da capire, lo stagno si distribuisce in maniera perfetta sulle piste.

perchè usare le millefori normali? a cosa si usano? e soprattutto.. come fare a saldare lì sopra dei pin vicini??
59  Using Arduino / Networking, Protocols, and Devices / Re: lowering I2C speed with arduino UNO on: November 18, 2012, 06:20:52 am
i doesn't have pullup resistor.. i thought the internal one was ok..

EDIT: great page anyway, thanks!
60  Using Arduino / Networking, Protocols, and Devices / lowering I2C speed with arduino UNO on: November 17, 2012, 08:11:47 am
hi!
i am not an arduino guy, and i have a poor electronic background. i use arduino only for fun in the spare. and this is my first project with multiple arduino communications. so sorry me if i write stupid things (and sorry for my bad english, too).

i have some boards that are communicating with i2c. but for reduce the noise signal i have set the velocity of the communication slower (following this: http://arduino.cc/forum/index.php/topic,12518.0.html ). the noise is caused by the long wire (more then 2 meters).

Yeah ok i know i should use some bus extender and this is a dirty hack, but for now it seems to works. I have tested it with the new Arduino Leonardo and it works right. One master (the master is an arduino MEGA), 2 leonardo childs, no problem. But it seems to have problem with older arduino (Arduino UNO).

I have tested it with a simple sketch, with one master and one slave: the master request one byte of status (0 or 1, ready or busy) each 500 milliseconds and if master recive something from serial, it send a number from 0 to 9999 to the slave (and the slave stay busy for that number of milliseconds).

Same code, same wiring (3 wires from master to slave: gnd, slc, sda), with a leonardo as slave, no problems, with UNO as slave, after the first request the communication crashes (and cause also the master to crash because there is no timeout in standard wiring library - untill i unplug the slave).

Some advice or any consideration of any kind?
Pages: 1 2 3 [4] 5 6 ... 9