Recent Forum Posts
From categories:
page 1123...next »

The RGB Matrix r2 has full color (PWM) capability, but it is backward compatible with the 8-color mode (BIN). I tried out the BIN mode when I wanted a faster display update, by simply calling the generating function with:

#define MATRIX_TYPE RGB_MATRIX_PWM   //RGB_MATRIX_BIN or RGB_MATRIX_PWM

#if MATRIX_TYPE==RGB_MATRIX_PWM
  uint8_t buf[RGB_MATRIX_PWM_BUF];
#else
  uint8_t buf[RGB_MATRIX_BIN_BUF];
#endif

RGB_Matrix matrix[MATRIX_ROWS][MATRIX_COLS] = {
  RGB_Matrix((uint8_t)0x50, buf, MATRIX_TYPE),
  RGB_Matrix((uint8_t)0x51, buf, MATRIX_TYPE),
  RGB_Matrix((uint8_t)0x52, buf, MATRIX_TYPE),
  RGB_Matrix((uint8_t)0x53, buf, MATRIX_TYPE)
};

But I got very chaotic results. On further testing, I found the columns were simply in reverse order for the green component. I worked around the problem by modifying one line of the library RGB_Matrix_Arduino.cpp:

    } else {
        //Serial.println("Setting BIN pixel");
        (red) ? _buf[row]         |= _BV(col)     : _buf[row]         &= ~_BV(col);
//        (grn) ? _buf[row + 8]     |= _BV(col)     : _buf[row + 8]     &= ~_BV(col);
        (grn) ? _buf[row + 8]     |= _BV(7-col)     : _buf[row + 8]     &= ~_BV(7-col); // srs 2015-02-14; green was going backwards
        (blu) ? _buf[row + 16]     |= _BV(col)     : _buf[row + 16]     &= ~_BV(col);
    }

I don't know if that was the best place to make the change, but it seems to have worked. I would be interested to know if anyone else has seen the same thing.

Okay, duh. I don't know what I was thinking. Making an array of RGB_Matrix objects works fine, if you use the right kind of brackets:

uint8_t buf[192];
RGB_Matrix matrix[MATRIX_ROWS][MATRIX_COLS] = {
  RGB_Matrix((uint8_t)0x50, buf),
  RGB_Matrix((uint8_t)0x51, buf),
  RGB_Matrix((uint8_t)0x52, buf),
  RGB_Matrix((uint8_t)0x53, buf)
};
void transmitScreen(void) {
  int i,j,k,row,col;
  k = 0;
  for (i = 0; i < MATRIX_ROWS; i++) {
    for (j = 0; j < MATRIX_COLS; j++) {
      for (row = 0; row < 8; row++) {
        for (col = 0; col < 8; col++) {
          matrix[i][j].setPixel( row, col, screen_r[row+8*i][col+8*j], screen_g[row+8*i][col+8*j], screen_b[row+8*i][col+8*j] );
        }
      }
      matrix[i][j].transmitBuf();
    }
  }
}

This is a simple thing, but it's kind of fun to watch. Four RGB Matrix r2 units are placed in a 2x2 array to create a 16x16 screen. A dot "walks" around the screen with a random color at each step. The trail it leaves behind fades exponentially, creating a natural appearance.

I had a bit of trouble handling the four Matrices in the code. At the outset, I assumed I would be able to create an array of "RGB_Matrix" objects. Then, for example, I would be able to make statements like:
matrix[i].setPixel( row, col, color)
But I was unable to make that happen. Instead, I just declared four separate variables, one for each 8x8 matrix. My object-oriented coding experience is nearly non-existent, so it's possible that I just failed to get the syntax right. I crammed all the inelegant parts into a function called transmitScreen(), included in the code below.

#include <Wire.h>
#include <RGB_Matrix_Arduino.h>

// arrangement of 8x8 matrices
#define MATRIX_ROWS 2
#define MATRIX_COLS 2

// screen dimensions (all LED arrays together)
#define NUM_ROWS 8*MATRIX_ROWS
#define NUM_COLS 8*MATRIX_COLS

// Arrays holding current red, green, blue intensities for every pixel
uint8_t screen_r[NUM_ROWS][NUM_COLS];
uint8_t screen_g[NUM_ROWS][NUM_COLS];
uint8_t screen_b[NUM_ROWS][NUM_COLS];

uint8_t buf[192];
RGB_Matrix matrix0 = RGB_Matrix((uint8_t)0x50, buf);
RGB_Matrix matrix1 = RGB_Matrix((uint8_t)0x51, buf);
RGB_Matrix matrix2 = RGB_Matrix((uint8_t)0x52, buf);
RGB_Matrix matrix3 = RGB_Matrix((uint8_t)0x53, buf);

void setup (void) {
//  Serial.begin(57600);
//  Serial.println("I live!");
  int i,j;
  for (i = 0; i < NUM_ROWS; i++) {
    for (j = 0; j < NUM_COLS; j++) {
      screen_r[i][j] = 0;
      screen_g[i][j] = 0;
      screen_b[i][j] = 0;
    }
  }
  Wire.begin();
  transmitScreen();
}

void loop (void) {
  static uint32_t color;
  uint8_t i, j, k, walk, red, green, blue;
  static int8_t annie_row=4, annie_col=4;

  //write out the whole screen
  transmitScreen();
  delay(20);

  walk = random(9);
  switch (walk) {
    case 0:
      if (++annie_row >= NUM_ROWS) annie_row = NUM_ROWS-1 ;
      break;
    case 1:
      if (--annie_row < 0) annie_row = 0 ;
      break;
    case 2:
      if (++annie_col >= NUM_COLS) annie_col = NUM_COLS-1;
      break;
    case 3:
      if (--annie_col < 0) annie_col = 0;
      break;
    case 4:
      if (++annie_row >= NUM_ROWS) annie_row = NUM_ROWS-1 ;
      if (++annie_col >= NUM_COLS) annie_col = NUM_COLS-1;
      break;
    case 5:
      if (--annie_row < 0) annie_row = 0 ;
      if (++annie_col >= NUM_COLS) annie_col = NUM_COLS-1;
     break;
    case 6:
      if (++annie_row >= NUM_ROWS) annie_row = NUM_ROWS-1 ;
      if (--annie_col < 0) annie_col = 0;
      break;
    case 7:
      if (--annie_row < 0) annie_row = 0 ;
      if (--annie_col < 0) annie_col = 0;
      break;
    default:
      ;//don't move
  }

  // light up annie's new location
  switch (random(6)) {
    case 0:
      screen_r[annie_row][annie_col]+= 0x60;
      break;
    case 1:
      screen_g[annie_row][annie_col]+= 0x60;
      break;
    case 2:
      screen_b[annie_row][annie_col]+= 0x60;
    case 3:
      screen_r[annie_row][annie_col]+= 0x30;
      screen_g[annie_row][annie_col]+= 0x30;
      break;
    case 4:
      screen_g[annie_row][annie_col]+= 0x30;
      screen_b[annie_row][annie_col]+= 0x30;
      break;
    case 5:
      screen_b[annie_row][annie_col]+= 0x30;
      screen_r[annie_row][annie_col]+= 0x30;
  }

  // fade entire array a bit
  for (i = 0; i < NUM_ROWS; i++) {
    for (j = 0; j < NUM_COLS; j++) {
      red = screen_r[i][j];
      green = screen_g[i][j];
      blue = screen_b[i][j];
      red = ((red<<3) - red)>>3;
      green = ((green<<3) - green)>>3;
      blue = ((blue<<3) - blue)>>3;
      screen_r[i][j] = red;
      screen_g[i][j] = green;
      screen_b[i][j] = blue;

    }
  }

}

void transmitScreen(void) {
  int i,j,k,row,col;
  k = 0;
  for (i = 0; i < MATRIX_ROWS; i++) {
    for (j = 0; j < MATRIX_COLS; j++) {
      for (row = 0; row < 8; row++) {
        for (col = 0; col < 8; col++) {
          switch (k) {
            case 0: 
              matrix0.setPixel( row, col, screen_r[row+8*i][col+8*j], screen_g[row+8*i][col+8*j], screen_b[row+8*i][col+8*j] );
              break;
            case 1: 
              matrix1.setPixel( row, col, screen_r[row+8*i][col+8*j], screen_g[row+8*i][col+8*j], screen_b[row+8*i][col+8*j] );
              break;
            case 2: 
              matrix2.setPixel( row, col, screen_r[row+8*i][col+8*j], screen_g[row+8*i][col+8*j], screen_b[row+8*i][col+8*j] );
              break;
            case 3: 
              matrix3.setPixel( row, col, screen_r[row+8*i][col+8*j], screen_g[row+8*i][col+8*j], screen_b[row+8*i][col+8*j] );
              break;              
          }
        }
      }
      switch (k) {
        case 0: 
          matrix0.transmitBuf();
          break;
        case 1: 
          matrix1.transmitBuf();
          break;
        case 2: 
          matrix2.transmitBuf();
          break;
        case 3: 
          matrix3.transmitBuf();
          break;      
      }
      k++;
    }
  }
}
crawling dot with trail by Steve SpielmanSteve Spielman, 18 Jan 2015 08:44
Simone (guest) 18 Oct 2014 21:18
in discussion Products / Shift Register Boards » Startup reference for 4 x 4 driver board

I should probably add that on the client side I am transforming each byte into a an ascii char and then send the list of bytes (one for each shift register) to the serial port.

by Simone (guest), 18 Oct 2014 21:18
Simone (guest) 18 Oct 2014 19:48
in discussion Products / Shift Register Boards » Startup reference for 4 x 4 driver board

Hallo
I am facing a weird behavior with these boards, the pin 7 of the first shift register doesn't switch, but the pin 7 pf the second switch register switches bot itself and the pin 7 of the first register, here is my code:

 //Pin connected to ST_CP of 74HC595
int latchPin = 7;
//Pin connected to SH_CP of 74HC595
int clockPin = 13;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {

  if (Serial.available() > 3) {

    //preparamos para enviar datos
    digitalWrite(latchPin, 0); 
    digitalWrite(8, HIGH); // Deactivates master reset ESTO VA FUERA DEL LOOP O NO?

    //contamos los numeros de shift registers conectados 
    for (int i=0 ; i < 4; i++)
    {
      //byte a=(byte) Serial.read() - '0';
      //leimos el contenido del puerto serial
      byte a=(byte) Serial.read();

      //move 'em out
      shiftOut(dataPin, clockPin, a);
      //digitalWrite(latchPin, 1);
      Serial.println(a);
    }

    digitalWrite(latchPin, 1);
  }
}

// the heart of the program
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first, 
  //on the rising edge of the clock,
  //clock idles low

  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);

  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);

  //for each bit in the byte myDataOut�
  //NOTICE THAT WE ARE COUNTING DOWN in our for loop
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights. 
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result 
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000 
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {  
      pinState= 0;
    }

    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin  
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  }

  //stop shifting
  digitalWrite(myClockPin, 0);
}
by Simone (guest), 18 Oct 2014 19:48

Digital pins 1-13 on the Galileo do not carry any of the signals you need. You only need four of the ten wires — 5V, ground, SCL, and SDA. The legend on the back of the board shows which is which. Also note that the 10 pin connector is intended to go on the back side of the board, where the legend for it is.

Assuming you have the ribbon cable set up so that the colored stripe is on the same side of the connector as the molded-in arrow, and your connector is on the back side, the stripe is pin 1 and the other pins count from there.

All that said, the four signals that need to be connected connect to the pins with the matching labels on the Galileo. 5V and GND connect to the corresponding pins in the power connector. SDA and SCL connect to the corresponding pins on the same row with digital pins 8-13.

Is that all reasonably clear?

Hi my 13 year old I are brand new to arduino (specifically an Intel Galileo board) and bought your RGB Matrix Backpack v1 at the Seattle Makers Fair. We have fallowed the instructions for performing the soldering, but are now stuck due to being SO new. We bought a 10 pin ribbon cable and have plugged it into the backpack and have stripped the wires on the other end. Any help in figuring out which of pins 1-13 to put each wire on the cable into would be very helpful and keep us going on our new technical adventure.

Any help is greatly appreciated.

MikeyDude (guest) 27 Jan 2014 05:04
in discussion Products / Shift Register Boards » Startup reference for 4 x 4 driver board

I have a different question.
Can the 4x4 Driver Shield switch ac voltage or half rectified ac voltage?
I want to use the 4x4 Driver shield to switch GE #RR7 24v low voltage lighting relays.

by MikeyDude (guest), 27 Jan 2014 05:04

Hello,
I recently purchased the 4 x 4 driver shield and I hope to use it to drive 8 dc brush motors. For each motor I need forward/reverse control. Is there a way to use the extra switches from the driver ICs to change polarity of the motor voltage so that I can reverse the motors?

Thanks in advance,
Nathan

I tested the BitCloud code by led blink and microcontroller stops on the SYS_SysInit();
this function requires compiled and closed source. Probably the SYS_SysInit() uses HAL_Init(); so I checked this. Now the program stops on halStartingCalibrate(); Any ideas how to modified the halStartingCalibrate() function to properly calibrate the microcontroler with RF? is it possible that some electronic periphery could desynchronize the microcontroler at this moment on zigduino platform?

Re: Zigduino r2 and BitCloud by vinstrolvinstrol, 11 Sep 2013 09:49

Hi !!

Also i am not able to read anything from input pins even without the shield. I have followed all the steps for Installing the Environment as per

zigduino-r2-manual#toc29 link in wiki.logos

I am not getting what is going wrong.

Kindly help resolving the issue.

Regards
Anurag

Hi there,

I am not able to use the e-Health sensor platform with Zigduino R2, the daughter board works very fine with the Ardiono uno and is compatible with Ardiono uno and mega board, as the Zigduino R2 is also pin compatible with the Arduino Uno it should work with that. but it's not :(

Here is the link for the e-Health sensor platform.

oops !!! I am not able to post links as am new user .

you can find the e-Health Sensor platform on cooking Hacks website.

The Windows tarball contains a newer version of WinAVR than the standard distribution (2010 vs 2008). You need to replace the existing version with the newer version.

Also, make sure that hardware/arduino/variants/zigduino_r2 is present and populated.

Yes I have it.
Actually this is the error:

unknown MCU 'atmega128rfa1' specified
Known MCU names:
avr2
at90s2313
at90s2323
at90s2333
at90s2343
attiny22
attiny26
at90s4414
at90s4433
at90s4434
at90s8515
at90c8534
at90s8535
avr25
attiny13
attiny13a
attiny2313
attiny24
attiny44
attiny84
attiny25
attiny45
attiny85
attiny261
attiny461
attiny861
attiny43u
attiny48
attiny88
at86rf401
avr3
at43usb320
at43usb355
at76c711
avr31
atmega103
avr35
at90usb82
at90usb162
attiny167
avr4
atmega8
atmega48
atmega48p
atmega88
atmega88p
atmega8515
atmega8535
atmega8hva
at90pwm1
at90pwm2
at90pwm2b
at90pwm3
at90pwm3b
avr5
atmega16
atmega161
atmega162
atmega163
atmega164p
atmega165
atmega165p
atmega168
atmega168p
atmega169
atmega169p
atmega32
atmega323
atmega324p
atmega325
atmega325p
atmega3250
atmega3250p
atmega328p
atmega329
atmega329p
atmega3290
atmega3290p
atmega406
atmega64
atmega640
atmega644
atmega644p
atmega645
atmega6450
atmega649
atmega6490
atmega16hva
at90can32
at90can64
at90pwm216
at90pwm316
atmega32m1
atmega32c1
atmega32u4
atmega32u6
at90usb646
at90usb647
at94k
avr51
atmega128
atmega1280
atmega1281
atmega1284p
at90can128
at90usb1286
at90usb1287
avr6
atmega2560
atmega2561
avrxmega4
atxmega64a3
avrxmega5
atxmega64a1
avrxmega6
atxmega128a3
atxmega256a3
atxmega256a3b
avrxmega7
atxmega128a1
avr1
at90s1200
attiny11
attiny12
attiny15
attiny28
Blink.cpp:1: error: MCU 'atmega128rfa1' supported for assembler only
In file included from Blink.ino:10:
C:\Users\Lex\Downloads\arduino-1.0.5-windows\arduino-1.0.5\hardware\arduino\cores\zigduino/Arduino.h:209:26: error: pins_arduino.h: No such file or directory

Is arduino/hardware/arduino/cores/zigduino present and populated?

Hi all,

I just bought a zigdruino r2, I followed all the directions on zigduino-manual and installed the environment. Now I have a ‘Zigduino’ entry in my Tools > Boards pull-down.

I have an error when I am trying to compile this code

 #include "Arduino.h"

 void setup()
 {
   Serial.begin(9600);
 }

 void loop()
 {
   Serial.write("Hello World");
 }

The error is:"Serial" is not detected in this scoop.
Anyone can help ?
Thanks

I compiled successful BitCloud stack ver 1.14 in avrstudio 6.1 and now I have a problem to connect to PC by USART and use WSNDemo application.
My fusebits configuration:
Fuse:
Extended 0xFF
High 0x9c
Low 0x62

used makefile: Coordinator_Stk600_Atmega128rfa1_8Mhz

the part of my configuration.h file:

//-----------------------------------------------
//BOARD_STK600
//-----------------------------------------------
#ifdef BOARD_STK600
  // Defines primary serial interface type to be used by application.
  #define APP_INTERFACE APP_INTERFACE_USART
  //#define APP_INTERFACE APP_INTERFACE_SPI

  //-----------------------------------------------
  //APP_INTERFACE == APP_INTERFACE_USART
  //-----------------------------------------------
  #if (APP_INTERFACE == APP_INTERFACE_USART)
    // Defines USART interface name to be used by application.
    #define APP_USART_CHANNEL USART_CHANNEL_0
  #endif

  #endif
#endif

#define CS_CHANNEL_MASK (1L<<0x0f)
#define CS_EXT_PANID 0xAAAAAAAAAAAAAAAALL
#define CS_UID 0x01LL
#define CS_NWK_UNIQUE_ADDR 0
//#define CS_NWK_UNIQUE_ADDR 1

I tried both USART_CHANNEL_0 and USART_CHANNEL_1 connfiguration and hardware connection to UART1 and UART0, in both case the voltage on TX is 2.3V and still the same before and after reset. Earlier for test I used the ZigduinoRadio stack, it works fine and TX voltage was 3.3V if usart not send any data of course.

Do you have any solution how to looks configuration.h file or maybe post here working hex files, for test.

I will be grateful for any help.

Zigduino r2 and BitCloud by vinstrolvinstrol, 04 Jun 2013 10:43

Hello Logos,
Have you any solution about this software UART problem for zigduino R1? I try all other pin for RX, but I cant get the solution. So it would be great for me if you help me about this. Waiting for your kind reply.

In here I use Zigduino R1. And I need to use one additional software serial because of GPRS modem.
Yeah I use all other pin for receiving but till now I cant successful. What can I do now? It will be great if u check it and give me a fruitful solution.

The Zigduino r2 has two hardware UARTs. UART0 is connected to the USB serial and it can be found on the UART0 connector. UART1 is attached to the conventional Arduino UART position (D0/D1).

The reason you are probably having trouble is because the Zigduino has a different mapping from the Arduino layout to the chip than an Arduino Uno or similar. As a result, not all the interrupts match up. Have you tried using a different pin for the receive?

-p

Re: Zigduino Soft UART by Logos ElectroLogos Electro, 27 May 2013 00:30
page 1123...next »
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License