Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: LED matrix on: June 05, 2006, 04:50:04 am
Hej David,

Thanx! You're right...I fixed it...now I have the chip and the C code communicating very well...when I finish the project, I'll post sample codes for beginners like me...smiley
All best,
Tatjana

2  Forum 2005-2010 (read only) / Frequently-Asked Questions / LED matrix extruded in z direction on: May 28, 2006, 05:29:27 am
Hello!
I am quite new in the physical computing world and I need your help.
I want to upgrade my 6x6 LED matrix to 6x6x6 cube that works as 2D display with "extruded" z direction (basically it's like a chess board, where each field (e.g. A2 or B5) is in parallel with 5 more diods that turn on and off as the first one controlled by an OpenGL-Arduino code.
The matrix is controlled by an OpenGL program, which proceeds images taken from the camera and notices changes for 6x6 fields. Since the extreme case could require turning on all the LEDs, I have to count on much stronger current...
So, I'm thinking of having established serial communication in between OpenGL code and microchip on the Arduino board. OpenGL code should send array of data  to 12 pins (6 for rows A to F, 6 for coloumns 1-6). An OpenGl code proceeds image taken from the camera  and for example if something happens on the field A5, the pins set to A and to 5 should be high...only in case if the two pins controling the exact row and exact column are set to high should turn the LED high (e.g. digital.Write(pinA, HIGH); digital.Write(pin5, HIGH); )
I'm thinking to use power transistor Darlingtons for this purpose. However, I set the codes in C and Arduino for test communication ( and printing for debugging), but there is probably something that I'm missing... I don't know how to send the data from computer to Arduino chip to clearly know what to do...this far I came on my own...
I would appreciate if you take a look at this codes and give some advice how to solve this...
Thank you very much,
Tatjana
...
//C code sends data from the computer
/* Standard input/output definitions */
#include <stdio.h>  
/* String function definitions */
#include <string.h>  
/* UNIX standard function definitions */
#include <unistd.h>  
/* File control definitions */
#include <fcntl.h>  
/* Error number definitions */
#include <errno.h>  
/* POSIX terminal control definitions */
#include <termios.h>


#define BAUDRATE B9600
#define MODEMDEVICE "/dev/ttyUSB0"
#define _POSIX_SOURCE 1 /* POSIX compliant source */
#define FALSE 0
#define TRUE 1

int fd;
int n;

//FILE *input;
int output;
char readBuf[255];  //buffer for where data is put

int main(void)
{

      //init serial stuff

      struct termios oldtio, newtio;
        
      /* open the device to be non-blocking (read will return immediatly) */
      fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY);
      
      if (fd <0) {
         perror(MODEMDEVICE);
         return(-1);
           }  
  
      tcgetattr(fd,&oldtio); /* save current port settings */
      /* set new port settings for canonical input processing */
      newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
      newtio.c_iflag = IGNPAR | ICRNL;
      newtio.c_oflag = 0;
      newtio.c_lflag = ICANON;
      newtio.c_cc[VMIN]=1;
      newtio.c_cc[VTIME]=0;
      tcflush(fd, TCIFLUSH);
      tcsetattr(fd,TCSANOW,&newtio);
        


      //fd_set input;
        fd_set output;
      struct timeval timeout;
      int res;
      int paramValue;

      FD_ZERO(&output);
      FD_SET(fd, &output);
      timeout.tv_sec = 0;
      timeout.tv_usec = 0;
        
      while(write(fd+1, &output,&timeout)) {
        res = write(fd, readBuf, 1);
        }
                
      FD_ZERO(&output);
                
      FD_SET(fd, &output);
      timeout.tv_sec = 0;
      timeout.tv_usec = 0;
}

....

// On Arduino

int ledPin = 13; //select the pin for LED

int val;

int serialGet = 0; //variable to store the value coming from the serial port

int delaytime = 1; //delaytime for the main loop





void setup() {

  pinMode(ledPin, OUTPUT); //declared LED as output

  beginSerial(9600);

  }

  

void loop() {

 // if (Serial.available() > 0)

  serialGet = serialRead(); //read the serial port

  if (serialGet != -1) { //if the input is -1, then there is no data

    val = serialGet;     //otherwise store it

    }

  if (val == 'H') {

    digitalWrite(ledPin, HIGH);

    Serial.print("I received: ");

    Serial.println(val);

    } else if(val == 'L') {

      digitalWrite(ledPin, LOW);

      Serial.print("I received: ");

      Serial.println(val);

      }

      delay(delaytime);

}
3  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: LED matrix on: April 18, 2006, 08:02:51 am
Hi Massimo,
Thank you very much!
I need some time now to figure things out...
All best,
Tatjana
4  Forum 2005-2010 (read only) / Frequently-Asked Questions / LED matrix on: April 16, 2006, 11:29:01 am
Hi!
I would like to control individually 36 LEDs in 6x6 matrix by an OpenGL programme well known as PPM reader. Do you have any suggestion on how to connect C code withe LEDs most efficiently in Arduino environment? I guess serial with multplexer would be a solution, but that's where my knowlegde ends so far...
Thank you in advance.
Best regards,
Tatjana
5  Forum 2005-2010 (read only) / Frequently-Asked Questions / Region text is full. Time interrupt? on: June 11, 2006, 04:33:56 am
Hi!

I've got the message that Region text is full, which makes me think that I must rewrite the code...
However, I don't know how to do it by myself, so I would appreciate your advice and/or sample codes...

What I'm trying to do is to control 6x6 LED matrix by 6+6 Darlington power transistors, which are connected to pins on Arduino board. I did not use the LED driver since I have 6 more LEDs connected in parallel to each of the basic of the above mentioned 6x6 LEDs. It takes more current than for usual LED drivers. The 6x6x6 LED cube display should work as 2D matrix (with an "extruded" 3rd dimension), by turning on and off the LEDs if the sent characters from the computer are capital or small...

So, I'm trying to build my own "driver" from transistors, by having if...else blocks...
I use an OpenGL PPM program as an input.  It maps changes on images like a chess-board but 6x6 and sends characters like 'A'-'Z' and '1'-'0' for activated fields and ON, and 'a'-'z' and '!'-'='. for OFF.
I used this encoding scheme since it's easier for me to debug it if something goes wrong....but still, there are 72 if else-s...

Here I attach the sample of code...I would like to make it faster, like real display works, by using the time interrupt function and sort of "scannning" one line, but I'm not sure how to do that. I guess six of the pins should be acting as "bus", but I don't know how to program that when I use not bits, but characters...

Please help, I need the prototype to work properly for my thesis presentation on friday ....

Thank you in advance,

Tatjana

//columns
int Pin1= 13;
int Pin2= 12;
int Pin3= 11;
int Pin4= 10;
int Pin5=  9;
int Pin6=  8;
//rows
int Pin7 = 7;
int Pin8 = 6;
int Pin9 = 5;
int Pin10= 4;
int Pin11= 3;
int Pin12= 2;
int val;
int serialGet = 0; //value from the serial port
int delaytime = 1; //for the main loop
void setup() {
   pinMode(Pin1, OUTPUT);
   pinMode(Pin2, OUTPUT);
   pinMode(Pin3, OUTPUT);
   pinMode(Pin4, OUTPUT);
   pinMode(Pin5, OUTPUT);
   pinMode(Pin6, OUTPUT);
   pinMode(Pin7, OUTPUT);
   pinMode(Pin8, OUTPUT);
   pinMode(Pin9, OUTPUT);
   pinMode(Pin10, OUTPUT);
   pinMode(Pin11, OUTPUT);
   pinMode(Pin12, OUTPUT);  
   beginSerial(9600);
   Serial.println("Startup ");
        }        
void loop()
{
  if (Serial.available() > 0) {  
    serialGet = serialRead(); //read the serial port
    if (serialGet != -1) { //if the input is -1, then there is no data
      val = serialGet;     //otherwise store it
      Serial.println(val);
       }
  }
  //first of the three boards, 12 LEDs controlled by 2 + 6 pins connected to transistors
  //control by pins 1 & 2 matching the same values with pins 7-12)
  //charactersON { A, B, G, H, M, N, S, T, Y, Z, 5, 6}
  //charactersOFF { a, b, g, h, m, n, s, t, y, z, %, &}  
  if (val == 'A') {
    digitalWrite(Pin1, 0);
    digitalWrite(Pin7, 0);
    val = 0;
    } else if(val == 'a') {
      digitalWrite(Pin1, 1);
      digitalWrite(Pin7, 1);
      val = 0;      
    } if (val == 'B') {
    digitalWrite(Pin2, 0);
    digitalWrite(Pin7, 0);
    val = 0;
    } else if(val == 'b') {
      digitalWrite(Pin2, 1);
      digitalWrite(Pin7, 1);
      val = 0;      
    }if (val == 'G') {
    digitalWrite(Pin1, 0);
    digitalWrite(Pin8, 0);
    val = 0;
    } else if(val == 'g') {
      digitalWrite(Pin1, 1);
      digitalWrite(Pin8, 1);
      val = 0;      
    } if (val == 'H') {
    digitalWrite(Pin2, 0);
    digitalWrite(Pin8, 0);
    val = 0;
    } else if(val == 'h') {
      digitalWrite(Pin2, 1);
      digitalWrite(Pin8, 1);
      val = 0;      
    } if (val == 'M') {
    digitalWrite(Pin1, 0);
    digitalWrite(Pin9, 0);
    val = 0;
    } else if(val == 'm') {
      digitalWrite(Pin1, 1);
      digitalWrite(Pin9, 1);
      val = 0;      
    }
// etc.....//

} if (val == '0') {
    digitalWrite(Pin6, 0);
    digitalWrite(Pin12, 0);
    val = 0;
    } else if(val == '=') {
      digitalWrite(Pin6, 1);
      digitalWrite(Pin12, 1);
      val = 0;      
    }
    delay(delaytime);
   }
6  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: error: stray '\' on: June 11, 2006, 03:59:23 am

Thanx Mellis!

Yes, I found accidently typed character ' ' '

All best,
Tatjana
7  Forum 2005-2010 (read only) / Frequently-Asked Questions / error: stray '\' on: June 05, 2006, 05:08:28 am
Hello,

I got this when I tried to compile the code:

error: stray '\' in program In function 'void loop()':

What does it mean?

Best regards,
Tatjana
8  Forum 2005-2010 (read only) / Frequently-Asked Questions / Serial - buffer? on: May 29, 2006, 10:46:50 am

Hi!

I need your help again. I'm trying to send data characters from C program through serial communication to Arduino.
But, it seems that microchip reads values L(low) and H(high) just for 5 seconds and then it gets silent or stucked. Do I need to set a buffer in the Arduino code?
Here I attach samples of the codes. Please take a look...

Thanx,
Tatjana

....
//Arduino code

int ledPin = 13; //select the pin for LED

int controlPin = 12;

int val;

int serialGet = 0; //variable to store the value coming from the serial port

int delaytime = 1; //delaytime for the main loop

//int timer;





void setup() {

  pinMode(ledPin, OUTPUT); //declared LED as output

  beginSerial(9600);

  pinMode(controlPin, OUTPUT);

  }

  

void loop()

{

 // if (Serial.available() > 0)

  serialGet = serialRead(); //read the serial port

  if (serialGet != -1) { //if the input is -1, then there is no data

    val = serialGet;     //otherwise store it

    //Serial.print("Nothing");

    }

  if (val == 'H') {

    digitalWrite(ledPin, HIGH);

    Serial.print("I received: ");

    Serial.println(val);

    val=0;

    } else if(val == 'L') {

      digitalWrite(ledPin, LOW);

      Serial.print("I received: ");

      Serial.println(val);

      val=0;

      }

       digitalWrite(controlPin, HIGH);

       delay(1000);      

       digitalWrite(controlPin, LOW);

       delay(1000);

       delay(delaytime);

}


......

//C code

/* Standard input/output definitions */
#include <stdio.h>  
/* String function definitions */
#include <string.h>  
/* UNIX standard function definitions */
#include <unistd.h>  
/* File control definitions */
#include <fcntl.h>  
/* Error number definitions */
#include <errno.h>  
/* POSIX terminal control definitions */
#include <termios.h>


#define BAUDRATE B9600
#define MODEMDEVICE "/dev/ttyUSB0"
#define _POSIX_SOURCE 1 /* POSIX compliant source */
#define FALSE 0
#define TRUE 1

int fd;
int n;

//FILE *input;
int output;
char readBuf[255];  //buffer for where data is put

int main(void)
{

      //init serial stuff

      struct termios oldtio, newtio;
        
      /* open the device to be non-blocking (read will return immediatly) */
      fd = open(MODEMDEVICE, O_RDWR | O_NOCTTY);
      
      if (fd <0) {
         perror(MODEMDEVICE);
         return(-1);
           }  
  
      tcgetattr(fd,&oldtio); /* save current port settings */
      /* set new port settings for canonical input processing */
      newtio.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
      newtio.c_iflag = IGNPAR | ICRNL;
      newtio.c_oflag = 0;
      newtio.c_lflag = ICANON;
      newtio.c_cc[VMIN]=1;
      newtio.c_cc[VTIME]=0;
      tcflush(fd, TCIFLUSH);
      tcsetattr(fd,TCSANOW,&newtio);
        


      //fd_set input;
        fd_set output;
      struct timeval timeout;
      int i;
      int res;
      int paramValue;
        
      FD_ZERO(&output);
      FD_SET(fd, &output);
      timeout.tv_sec = 0;
      timeout.tv_usec = 0;
        
      for( i = 0; i < 500; i++){
            if (i % 2){
                  printf("H\n");
                      write(fd, "H", 1);
              } else {
                     printf("L\n");
                  write(fd, "L", 1);
        
              }
            sleep(2);
      }
                
      FD_ZERO(&output);
                
      FD_SET(fd, &output);
      timeout.tv_sec = 0;
      timeout.tv_usec = 0;
      return 0;
}
9  Forum 2005-2010 (read only) / Frequently-Asked Questions / Errors etc on: May 22, 2006, 10:29:31 am

Hello!

I am a beginner and I have a big problem to compile my first program under Linux. In Windows it works perfectly.
The list of errors under Linux appears as follows:

.....

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:25:20: error: avr/io.h: No such file or directory

In file included from /home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:26:

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/wiring.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'boolean'

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/wiring.h:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'byte'

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:66: error: 'DDRB' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:66: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:66: error: (near initialization for 'port_to_mode[2]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:67: error: 'DDRC' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:67: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:67: error: (near initialization for 'port_to_mode[3]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:68: error: 'DDRD' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:68: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:68: error: (near initialization for 'port_to_mode[4]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:74: error: 'PORTB' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:74: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:74: error: (near initialization for 'port_to_output[2]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:75: error: 'PORTC' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:75: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:75: error: (near initialization for 'port_to_output[3]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:76: error: 'PORTD' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:76: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:76: error: (near initialization for 'port_to_output[4]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:82: error: 'PINB' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:82: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:82: error: (near initialization for 'port_to_input[2]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:83: error: 'PINC' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:83: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:83: error: (near initialization for 'port_to_input[3]')

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:84: error: 'PIND' undeclared here (not in a function)

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:84: error: initializer element is not constant

/home/tj/Desktop/trunk/build/linux/work/lib/targets/arduino/pins_arduino.c:84: error: (near initialization for 'port_to_input[4]')

.....

How should I solve this? It's tidious work to compile program in Windows and then test them in Linux...I would like to use Arduino only under Linux Red Hat.Where can I make changes (preferences? setup?makefile?)
I hope that you will help me to solve this problem.

Thank you!
All best,
Tatjana



10  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Arduino on Red Hat on: May 18, 2006, 12:30:02 pm
Now it works!!!!
It complains about g++ though (which I generally do not need, since I use the plain C)
Thanx again, it was worth it...now I can work on the project smiley
All best,
Tatjana
11  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Arduino on Red Hat on: May 18, 2006, 09:54:03 am
Hi,
In addition to previous problem, this appeared:

[tj@dynamic-46-29 dist]$ ./arduino
Exception in thread "main" java.lang.NoClassDefFoundError: processing.app.Base
   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Caused by: java.lang.ClassNotFoundException: processing.app.Base not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./,file:lib/,file:./,file:./,file:./,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
   at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
   at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0)
   at java.lang.ClassLoader.loadClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
   at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
   at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)

Thanx & all best
Tatjana

12  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Arduino on Red Hat on: May 18, 2006, 09:43:07 am
Hi,
Now it's compiled. One of the paths in the makefile was the problem before.
However, new headache has come: the programs appear to exit after a second without any performance...

[tj@dynamic-46-29 linux]$ ./run.sh
[tj@dynamic-46-29 linux]$ cd work/
[tj@dynamic-46-29 work]$ ./arduino

Any idea?

Thanx,
Tatjana
13  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Arduino on Red Hat on: May 18, 2006, 08:04:05 am

Thanx, the part about rt.jar is fixed. Yet, there is a set of errors that goes like this:

[root@dynamic-46-29 linux]# ./make.sh
Copying shared and core files...
Extracting examples...
unzip:  cannot find or open ../shared/dist/examples.zip, ../shared/dist/examples.zip.zip or ../shared/dist/examples.zip.ZIP.
Copying dist files...
/usr/local/avr/bin/avr-gcc -g -Wall -Os -mmcu=atmega8 -Datmega8 -DF_CPU=16000000 -DBAUD_RATE=19200 -I/usr/local/avr/include -Wl,-Map,ATmegaBOOT.map,--section-start=.text=0x1c00 -o ATmegaBOOT.elf ATmegaBOOT.o
/usr/local/avr/lib/gcc/avr/4.0.3/../../../../avr/bin/ld: cannot find -lc
make: *** [ATmegaBOOT.elf] Error 1

...and I have no idea what to do now.
Please, help me...

Thank you,
Tatjana
14  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: Arduino on Red Hat on: May 17, 2006, 07:45:14 am
Hi Massimo and Mellis !
A colleague of mine has ixed some of the problems refering to includes and jikes,
but still we have the list of errors as follows:

[root@dynamic-46-29 linux]# ./make.sh
Copying shared and core files...
Extracting examples...
unzip:  cannot find or open ../shared/dist/examples.zip, ../shared/dist/examples.zip.zip or ../shared/dist/examples.zip.ZIP.
Copying dist files...
/usr/local/avr/bin/avr-gcc -g -Wall -Os -mmcu=atmega8 -Datmega8 -DF_CPU=16000000 -DBAUD_RATE=19200 -I/usr/local/avr/include -Wl,-Map,ATmegaBOOT.map,--section-start=.text=0x1c00 -o ATmegaBOOT.elf ATmegaBOOT.o
/usr/local/avr/lib/gcc/avr/4.0.3/../../../../avr/bin/ld: cannot find -lc
make: *** [ATmegaBOOT.elf] Error 1
Building the PDE...

Found 1 system error:

*** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Jikes could not find package "java.lang" in:
                ../build/linux/work/classes
                ../build/linux/work/lib/antlr.jar
                ../build/linux/work/lib/oro.jar
                ../build/linux/work/lib/registry.jar
                ../build/linux/work/lib/RXTXcomm.jar
                ../build/linux/work/lib/mrj.jar
                /usr/java/jdk1.5.0_06/bin
                .


Done.

Thank you in advance!
All best,
Tatjana

15  Forum 2005-2010 (read only) / Frequently-Asked Questions / Arduino on Red Hat on: May 15, 2006, 09:07:47 am

Hello!

I installed all the suggested stuff for Arduino on Linux(gcc, uisp,libc....subversion, java). However, it seems that it gets confused and is looking for libraries and includes in the folders where they are not. I guess I need to make some paths, but I don't know how. I've seen the whole forum on Arduino Debian topic instruction, but I'm unsure to copy-paste it literally. I'm quite new in this and I need your help.

Thank you in advance,
Tatjana
Pages: [1]