Pages: 1 [2]   Go Down
Author Topic: How do I Interface arduino with these guys?!?!?  (Read 2028 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
Interface Design Currently
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, i'll try that.

Im going to go to Hackspace London tonight armed with this thread to see if someone can help me.

I was asking about the Microprinter sketch because it sends HEX over Serial, and was hoping I might be able to do a similar thing if necessary/possible.



Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
Interface Design Currently
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes indeed, but in the microprinter sketch I say:

Code:
print ("I love printing");  
or
Code:
printer.println("Im a massive goober");

etc...
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
Interface Design Currently
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Let's totally ignore my question about the printer. I think I got excited. Will report back about how the next few hrs go.

Thanks again

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
Interface Design Currently
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ive got it completely sorted thanks to Nneil. All Hail Nneil. A true saint.
Thanks to everyone so far...

Decipher this....

3 boards
1 arduino
No Shifters
No Shifting
Custom clock
And some pretty tricky C arrays of arrays.

Code:
void setMode(int latchPin){  //sets pins to be outputs, setspins high
  int clockPin=latchPin+1;
  int dataPin=latchPin+2;
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  digitalWrite(latchPin, 1);
  digitalWrite(clockPin, 1);
  digitalWrite(dataPin, 1);
}

/*
void shortReset(int latchPin){
  int clockPin=latchPin+1;
  int dataPin=latchPin+2;
  digitalWrite(latchPin, 1);   // take the reset pin back hi
  delayMicroseconds(60);  
  digitalWrite(latchPin, 0);   // take the reset pin low
  delayMicroseconds(60);  
  digitalWrite(latchPin, 1);   // take the reset pin back hi
  delay(3);
}


void longReset(int latchPin){
  int clockPin=latchPin+1;
  int dataPin=latchPin+2;
  digitalWrite(latchPin, 1);   // take the reset pin back hi
  delayMicroseconds(60);  
  digitalWrite(latchPin, 0);   // take the reset pin low
  delayMicroseconds(60);  
  digitalWrite(latchPin, 1);   // take the reset pin back hi
  delay(3);
}
*/

void sendByte(int latchPin, unsigned int c){  // function sendByte send charactyer to board
  int clockPin=latchPin+1;
  int dataPin=latchPin+2;
  for(int i=7 ; i>=0 ; i--){  // steps thru bits in chars byte - MSB first
    digitalWrite(clockPin,1); // clock pin should already be high
    digitalWrite(dataPin,(c>>i)&1); // put out appropriate bit for char
    delayMicroseconds(100); // min 1 (barmy)
    digitalWrite(clockPin,0); // clockingdata into board
    delayMicroseconds(100);
    digitalWrite(clockPin,1);
  }
  delayMicroseconds(1000); //inter-byte delay
}

const int d=2000;  //long reset (min 2000)

void sendStr(int latchPin, const char * p){  //
  int clockPin=latchPin+1;            //
  int dataPin=latchPin+2;
  digitalWrite(latchPin, 0);   // take the reset pin low
  digitalWrite(dataPin, 0);    // & data pin low
  delayMicroseconds(d);  
  digitalWrite(latchPin, 1);   // take the reset pin back hi
  delayMicroseconds(d);
  digitalWrite(dataPin, 1);    // data back high
  delayMicroseconds(d);
  while(*p){ // while char is left in string -
    unsigned char c=*p;
    if(c>='a' && c<='z') c-='a'-'A';
    if(c>='@') c-='@';
    //shiftOut(dataPin, clockPin, MSBFIRST, c);
    //delayMicroseconds(70);
    sendByte(latchPin,c);
    p++;
  }
  delayMicroseconds(d);
}

const int board1=22;

const int board[]={22,26,30};

#define numrows  4  // no of rows of messages MUST MATCH no of rows

const int rowdelay=3;  // edit this number for delay time eg 3600 = 1hr

const char * text[numrows][3]=  // array of arrays of strings
{
  {"a","b","c"}
  ,{"dog","cat","pig"}
  ,{"aaa","bbb","ccc"}
  ,{"doggie","cato","piggy"}
};

void setup(){
  setMode(board[0]);
  setMode(board[1]);
  setMode(board[2]);
}

void loop() {
  sendStr(board[0],"BOARD 0");   // board itenitfier sequence
  delay(100);
  sendStr(board[1],"BOARD 1");
  delay(100);
  sendStr(board[2],"BOARD 2");
  delay(100);
  for(int i=0 ; i<=2 ; i++){
    sendStr(board[i],"");
    delay(100);
  }
  for(int i=0 ; i< 1; i++){
    char str[20];
    sprintf(str,"I=%d",i);
    sendStr(board[i%3],str);
    delay(500);                 // board itenitfier sequence
  }
  
  /////////////////
  
  for(int i=0; i<numrows ; i++){
    for(int j=0 ; j<3; j++){
      sendStr(board[j],text[i][j]);
    }
    for(int d=0 ; d<rowdelay ;d++){
      delay(1000);
    }
  }
  
  ////////////////////
}


Logged

Leeds, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 134
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Super, glad you got it working!
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
Interface Design Currently
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

im really happy
its effing gorgeous.
plus if you look at the code you'll see how elegantly its written.
Declaring the pins..
Numbering the boards..
Assigning the strings to the boards.. etc...

Really great Job.
Photos coming soon


i have no idea how to make a library

 smiley-grin
Logged

Pages: 1 [2]   Go Up
Jump to: