Show Posts
Pages: [1] 2 3
1  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 26, 2013, 10:18:01 am
lol I wish I could do this: 'Replace myself, let somebody else to do' but then explain to me howto.

I will give open-wrt a try. thanks!
2  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 26, 2013, 09:02:22 am
additionally to the commands I wrote above here is what I am using(in red) from my SSH login but I still can't 'echo':

root@DD-WRT:~# stty -F /dev/tts/0 raw
root@DD-WRT:~# stty -F /dev/tts/0 -echo -echoe -echok
root@DD-WRT:~# stty -F /dev/tts/0

and I get:

speed 115200 baud; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -echo -echoe -echok


and then:

root@DD-WRT:~# echo "Here I am" > /dev/tts/0 115200

I get nothing on the arduino serial monitor
3  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 26, 2013, 08:27:43 am
thanks for the response. It is def a good option but I have a lot of code from other projects running on dd-wrt/e1000 which I guess I will have to modify for the open-wrt. If I won't find a solution with the dd-wrt, I will try open-wrt. I am just not that familiar with linux so the syntax might be wrong?thanks for any hints.
4  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 26, 2013, 04:09:37 am
thanks a lot for the response and the hints. do you see anything wrong with the wiring in the attached image. any suggestions on the 'echo' command or how else can I verify that my serial works?
I am using this level converter:
http://www.adafruit.com/products/757
5  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 25, 2013, 06:47:58 am
when I SSH login in my router and I execute this command (in purple):
root@DD-WRT:~# ls /dev/tts/*
I get this:
/dev/tts/0  /dev/tts/1  /dev/tts/2  /dev/tts/3

are these the ports?

I tried all of the following from my router's login but I don't get anything on the arduino serial monitor:
echo "Here I am" > /dev/tts/0 115200
echo "Here I am" > /dev/tts/1 115200
echo "Here I am" > /dev/tts/2 115200
echo "Here I am" > /dev/tts/3 115200

any help appreciated
6  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 25, 2013, 05:38:32 am
a bit of progress; with this code I am able to read and write from/to my terminal:

arduino code:

Code:
int incomingByte = 0;   // for incoming serial data
void setup() {
        Serial.begin(115200);     // opens serial port, sets data rate to 9600 bps
        Serial.write("Hi, I am alive!");
}

void loop() {

        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();

                Serial.print("I received: ");
                Serial.println(incomingByte, DEC);
        }
}

by using these commands on my terminal

to write:
Code:
echo "Here I am" > /dev/tty.usbserial-A9007VSI 115200
to read:
Code:
screen  /dev/tty.usbserial-A9007VSI 115200

but when I SSH login to my router the above commands do not work,
when I try this command:

Code:
echo "Here I am" > /dev/tty.usbserial-A9007VSI 115200

I get this message:

-sh: can't create /dev/tty.usbserial-A9007VSI: Permission denied

any hint how to write to serial from within my dd-wrt SSH login much appreciated
7  Using Arduino / Networking, Protocols, and Devices / Re: ARDUINO & DD-WRT on: June 25, 2013, 03:26:59 am
ok I did the following:

I run this in arduino:
Code:
void setup(){
 Serial.write("Hi, I am alive!");
 }
 void loop(){
 }

and then I SSH to my Router and type in:

Code:
cat < /dev/cua/1
  and I get :
Code:
-sh: can't open /dev/cua/1: no such file

and also tried this:

Code:
cat < /dev/tty.usbserial-A9007VSI
and I get :
Code:
-sh: can't open /dev/tty.usbserial-A9007VSI: no such file

I saw this post here which was helpful but still I can't tx-rx between arduino and my router:
http://forum.arduino.cc/index.php/topic,39610.0.html
can somebody please explain. Thanks!
8  Using Arduino / Networking, Protocols, and Devices / ARDUINO & DD-WRT on: June 24, 2013, 03:16:14 pm
I know there are many threads on this but I am very confused so if someone can help me out I will really appreciate it because nothing seems to work.

I wired a DD-WRT router (e1000) to arduino via serial and I want to pass data( like packages TX/RX) from the router to the arduino. Where shall I start? What is the logical sequence because for example when I login via the terminal (mac) to my router and try to echo to arduino nothing happens.

please help. thanks
9  Using Arduino / Interfacing w/ Software on the Computer / Re: DATA FROM SERIAL CANNOT CONVERT TO INT on: January 05, 2012, 05:53:40 am
hello mike,
thanks a lot for the answer but I still have difficulties to use the reference you sent to write a working code in processing.Can I use atoi in processing?any hints directly on the processing language?..thanks for any answer (btw processing site is down at the moment so can't look there much)
10  Using Arduino / Interfacing w/ Software on the Computer / Data from serial cannot convert to int on: January 05, 2012, 04:24:05 am
Hello,

with this processing script below I get the right values into processing from Arduino, but

a. I can't convert the inByte to integer, when I do that I get 0.Why my variable numCol is 0?
b. How can I separate the incoming values for  R G B every 3 incoming values?

Any help very appreciated.
Code:
import processing.serial.*;
Serial port;
 
void setup(){
     size(45,45);
     port = new Serial(this,Serial.list()[1], 9600);
            }


void draw() {
  
         while (port.available() > 0) {
         String inByte = port.readStringUntil(10);
         if (inByte != null) {
         int numCol = int(inByte);
         print("in Byte : ");
         print(inByte);
         println(numCol);
       }
     }
 port.clear();
}


OR why my initial script - reading directly with int variables - does not give me the right values from Serial?

please see the processing code below:

Code:
import processing.serial.*;
Serial port;
int x=0;
int y=0;
int i=0;  
 
void setup(){
     size(45,45);
     port = new Serial(this,Serial.list()[1], 9600);
            }

void draw() {
  
     delay(1000);
     while (port.available() > 0) {
      
       int inByteRED = port.read();
       println("inByteRED");
       println(inByteRED);
       delay(1000);
       int inByteGREEN = port.read();
       println("inByteGREEN");
       println(inByteGREEN);
       delay(1000);
       int inByteBLUE = port.read();
       println("inByteBLUE");
       println(inByteBLUE);
       delay(1000);
        
       color c = color(inByteRED, inByteGREEN, inByteBLUE);
      
       //Size of each rectangle with disctinct color
       int rectsize=3;
       fill(c);
       noStroke();
       rect(x*rectsize , y*rectsize , rectsize , rectsize);

       x++;
      
       if (x > 14) {x = 0; y++;}
       if (y > 14) {noLoop();}      
          
    }
}    


11  Using Arduino / Storage / WRITE/ READ VALUE TO/FROM EEPROM - Storing Image on EEPROM through processing on: January 04, 2012, 04:21:03 pm
I am trying to store an image on EEPROM through processing. First, I upload the code you see below on Arduino and then pass the values through from processing to ARDUINO and EEPROM. In the arduino script I write on EEPROM and then I try to read the value I wrote and print it back to the serial..but the value I get is different from what I wrote or nonsense. First code is arduino and the second of processing for storing the image. Is this way to achieve what I want right? and if yes why I don't read the values that I write? Any help very appreciated.

ARDUINO CODE:
Code:
  #include <Wire.h> //I2C library
  byte inByte;
  int addr = 0;
  int pass = 0;

  // WARNING: address is a page address, 6-bit end will wrap around
  // also, data can be maximum of about 30 bytes, because the Wire library has a buffer of 32 bytes
  void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
    Wire.beginTransmission(deviceaddress);
    Wire.send((int)(eeaddresspage >> 8)); // MSB
    Wire.send((int)(eeaddresspage & 0xFF)); // LSB
    byte c;
    for ( c = 0; c < length; c++)
    Wire.send(data[c]);
    Wire.endTransmission();
  }
 
    byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
    byte rdata = 0xFF;
    Wire.beginTransmission(deviceaddress);
    Wire.send((int)(eeaddress >> 8)); // MSB
    Wire.send((int)(eeaddress & 0xFF)); // LSB
    Wire.endTransmission();
    Wire.requestFrom(deviceaddress,1);
    if (Wire.available()) rdata = Wire.receive();
    return rdata;
  }

  void setup()
  {
    Wire.begin(); // initialise the connection
    Serial.begin(9600);
  }
 
  void loop()
{
  if(Serial.available() > 0)
 
  {
      inByte = Serial.read(); // Read an incoming Byte from Processing
      char val = inByte;
      i2c_eeprom_write_page(0x50, addr, (byte *)val, sizeof(val)); // write to EEPROM
      addr = addr + 1;
      delay(10); //add a small delay
      Serial.print("Value written in Address ");
      Serial.println(addr);
      delay(500);
      byte b = i2c_eeprom_read_byte(0x50, addr); // access the first address from the memory
      Serial.print("Value read from EEPROM ");
      Serial.println(b,DEC);
  }
}

PROCESSING CODE:
Code:
//This code reads the pixel values of a 15x15 Matrix
import processing.serial.*;
Serial port;
int initval=0; //initial value that the matrix starts
int pixval=0; //pixel value each time
int rows = 15; //number of the matrix rows & columns
PImage myImage;
int pass = 0;
float clr;
int intclr;
String printclr;

void setup()
{
  port = new Serial(this,Serial.list()[1], 9600);
  size(50,50);
  myImage = loadImage("image_name.jpg");
  image (myImage, 0, 0, width, height);
  myImage.loadPixels();
}

void readPort()
{
  while(port.available()>0)
{
  char inChar = port.readChar();
  print(inChar);
}
println();
}

void draw()
{
  if(pass == 0)
  {
    pass = 1;
    delay(2000);
   
    for (int k=1;k<=rows;k++){
    for (pixval = pixval; pixval < initval + k*rows; pixval = pixval+1)
    {
color a = myImage.pixels[pixval];

        for(int j=0;j<3;j++){
         
             if (j==0)  { clr = red(a); printclr = "RED"; }
        else if (j==1)  { clr = green(a); printclr = "GREEN";}
        else if (j==2)  { clr = blue(a); printclr = "BLUE";}
 
intclr = int(clr);
print("Sending ");
        print(printclr);
        print(" value #");
print(pixval);
print(" ");
        println();
println(intclr);
        port.write(intclr);
delay(1500);
        readPort();     
    } 
   }
  }
 }
}
 
12  Using Arduino / Programming Questions / Re: ARDUINO 1.0 - error: WConstants.h: No such file or directory on: January 02, 2012, 04:46:02 pm
Below is the code of wire.h but where are the files inttypes.h & Stream.h located? Are in these files the send() & receive() that have to be replaced?thx!


Code:
#ifndef TwoWire_h
#define TwoWire_h

#include <inttypes.h>
#include "Stream.h"

#define BUFFER_LENGTH 32

class TwoWire : public Stream
{
  private:
    static uint8_t rxBuffer[];
    static uint8_t rxBufferIndex;
    static uint8_t rxBufferLength;

    static uint8_t txAddress;
    static uint8_t txBuffer[];
    static uint8_t txBufferIndex;
    static uint8_t txBufferLength;

    static uint8_t transmitting;
    static void (*user_onRequest)(void);
    static void (*user_onReceive)(int);
    static void onRequestService(void);
    static void onReceiveService(uint8_t*, int);
  public:
    TwoWire();
    void begin();
    void begin(uint8_t);
    void begin(int);
    void beginTransmission(uint8_t);
    void beginTransmission(int);
    uint8_t endTransmission(void);
    uint8_t requestFrom(uint8_t, uint8_t);
    uint8_t requestFrom(int, int);
    virtual size_t write(uint8_t);
    virtual size_t write(const uint8_t *, size_t);
    virtual int available(void);
    virtual int read(void);
    virtual int peek(void);
virtual void flush(void);
    void onReceive( void (*)(int) );
    void onRequest( void (*)(void) );
  
    using Print::write;
};

extern TwoWire Wire;

#endif
13  Using Arduino / Programming Questions / Re: ARDUINO 1.0 - error: WConstants.h: No such file or directory on: January 02, 2012, 04:40:43 pm
many thanks!!!this is fixed but I still get many errors.
They has to do with the replacement of send() and receive() with read() and write().
But in which file do I substitute this code?In which file should I substitute send() for read()?

I also don't understand the first error:

/Applications/Arduino.app/Contents/Resources/Java/libraries/E24C1024/E24C1024.cpp: In static member function 'static void E24C1024::write(long unsigned int, uint8_t)':

any help very appreciated.
14  Using Arduino / Programming Questions / Re: ARDUINO 1.0 - error: WConstants.h: No such file or directory on: January 02, 2012, 03:29:56 pm
btw I have already changed the first line to:

Code:
#include <Arduino.h>


instead of

Code:
#include <WProgram.h>

but I still get the error.

any hint highly appreciated.
15  Using Arduino / Programming Questions / ARDUINO 1.0 - error: WConstants.h: No such file or directory on: January 02, 2012, 03:12:23 pm
Hello,

the script below used to work with Arduino 0016.Now with hardware the Arduino UNO and Arduino 1.0 I get the error:

/Applications/Arduino.app/Contents/Resources/Java/libraries/E24C1024/E24C1024.h:47:24: error: WConstants.h: No such file or directory

that you see in attached image.
Can you please advise what changes I should do - probably with the libraries..many thanks

Code:
#include <WProgram.h>
#include <Wire.h>
#include <E24C1024.h>
#include <EEPROM.h>
byte inByte;   // Where to store the Bytes read
int ledPin = 13;  // Set the pin to digital I/O
int index = 0;
int addr = 0;
int pass = 0;

void setup()
{
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available() > 0)
  {
    inByte = Serial.read(); // Read a Byte
      int val = inByte;
      EEPROM1024.write(addr, val);
      addr = addr + 1;
      if (addr == 676)
      addr = 0;
      Serial.print("At the position ");
      Serial.print(index);
      Serial.print("  arduino received: ");
      Serial.println(inByte,DEC); 
      index++;
      Serial.print("At the position ");
      Serial.print(addr-1);
      Serial.print(" of EEPROM I wrote: ");
      Serial.print(val,DEC);
      Serial.println();
  }
}
 
Pages: [1] 2 3