Need help with compiling code

Status
Not open for further replies.

djcali

Member
Hello All,

I just purchased the Teensy 3.1 board and I am having trouble compiling some code that I will be using to create a WS2801 based LED Matrix. The code is verified to work with the Teensy 3.0 and used with Glediator Matrix Software. > http://www.youtube.com/watch?v=EW1Hkad2Zys

Equipment:
Teensy 3.1
Mac OSX 10.9.1
Audrino 1.0.5
Teensyduino 1.18 RC2

Here are the compile errors I'm getting:

Code:
  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
Arduino: 1.0.5 (Mac OS X), Board: "Teensy 3.1"
In file included from TEENSY_GLEDIATOR.ino:1:0:
/Applications/Arduino.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/usb_serial.h: In member function 'size_t usb_serial_class::readBytes(char*, size_t)':
/Applications/Arduino.app/Contents/Resources/Java/hardware/teensy/cores/teensy3/usb_serial.h:91:38: error: 'millis' was not declared in this scope


Here is the code:

Code:
#include <usb_serial.h>
 
// Matrix size 576 (32x18)
#define Num_Pixels 32
 
#define CMD_NEW_DATA 1
int SDI = 11; 
int CKI = 13;
 
unsigned char display_buffer[Num_Pixels * 3];
 
static unsigned char *ptr;
static unsigned int pos = 0;
 
volatile unsigned char go = 0;
 
void setup() 
{
  pinMode(SDI, OUTPUT);
  pinMode(CKI, OUTPUT); 
  Serial.begin(9600); // USB is always 12 Mbit/sec
}
 
void loop() 
{
  if (0<usb_serial_available()){
    unsigned char b;
    b = usb_serial_getchar();
 
  if (b == CMD_NEW_DATA)  {pos=0; ptr=display_buffer; return;}    
  if (pos == (Num_Pixels*3)) {} else {*ptr=b; ptr++; pos++;}  
  if (pos == ((Num_Pixels*3)-1)) {go=1;}
  }
  if (go==1) {shift_out_data(); go=0;}
        Serial.println(display_buffer[100]);
  
}
 
 
 
 
//############################################################################################################################################################
// Shift out Data                                                                                                                                            #
//############################################################################################################################################################
 
void shift_out_data()
{
 
  for (int i=0; i<Num_Pixels; i++)
  {
    byte r = display_buffer[i*3+0];
    byte g = display_buffer[i*3+1];
    byte b = display_buffer[i*3+2];
    
    for (byte j=0; j<8; j++)
    {
       digitalWrite(CKI, LOW);
       if (r & (byte)(1<<(7-j))) {digitalWrite(SDI, HIGH);} else {digitalWrite(SDI, LOW);}     
       digitalWrite(CKI, HIGH);
    }
    
    for (byte j=0; j<8; j++)
    {
       digitalWrite(CKI, LOW);
       if (g & (1<<(7-j))) {digitalWrite(SDI, HIGH);} else {digitalWrite(SDI, LOW);}     
       digitalWrite(CKI, HIGH); 
    }
    
    for (byte j=0; j<8; j++)
    {
       digitalWrite(CKI, LOW);
       if (b & (1<<(7-j))) {digitalWrite(SDI, HIGH);} else {digitalWrite(SDI, LOW);}     
       digitalWrite(CKI, HIGH);
    }
    
  }
  
  digitalWrite(CKI, LOW);
  delayMicroseconds(800); //Latch Data
 
}
 
Status
Not open for further replies.
Back
Top